Question : W3Schools Var-Op-F 26

 

Python Coding Questions (15)

  1. Create a list of numbers from 1 to 5. Then add the number 6 to the list using a method. Print the updated list.

  2. Given the list [1,2,3,9,4,6,7,8], write a program to find and print the highest number.

  3. Concatenate the first name "Jason" and last name "Kingsley" to form a full name. Print the result.

  4. You have a cash value '50'. Print it with a dollar sign in front (e.g., $50).

  5. Given the list of fruits ['apple','banana','mango','coconut'], print the first fruit in the list.

  6. Create a list [1,2,3,4,5]. Check if 20 is not in the list, and print "Yes" if it’s not there or "No" if it is.

  7. Given the list ['a','b','c','d'], remove the last item and print the new list.

  8. Given the list ['a','b','c','d'], remove the first item and print the new list.

  9. Add a new element 'e' to the list ['a','b','c','d'] and print the updated list.

  10. Write a program that asks the user for two numbers and divides them, then prints the result.

  11. Update the previous division program to handle errors using try-except so it doesn’t crash if the user enters letters or divides by zero.

  12. Write a program that finds the remainder when one number is divided by another using the modulus operator %.

  13. Explain the difference between a list and a set in Python. Give an example for each.

  14. Given the list ['mr. tee','jason','ire','mishael','janet','mikayla','percy','jason','ire','mishael','janet'], replace the 4th element with 'mary' and print the updated list.

  15. Convert the string '9' into an integer using type conversion. Print the value and its type.

Write what you are looking for, and press enter to begin your search!