Part1:Fill in the Blanks
Complete the following code snippets by filling in the blanks:
- pythonage = 20if age ___ 18:print("You are an adult.")else:print("You are a minor.")
- pythonscore = 75if score ___ 90:print("Grade: A")elif score ___ 80:print("Grade: B")elif score ___ 70:print("Grade: C")else:print("Grade: D")
Part 2: Write Your Own
Write Python code for the following scenarios:
Even or Odd:
- Prompt the user to enter a number.
- Print "Even" if the number is even, and "Odd" if the number is odd.
Temperature Check:
- Prompt the user to enter the current temperature in Fahrenheit.
- Print "It's hot!" if the temperature is above 85, "It's warm." if it's between 60 and 85, and "It's cold!" if it's below 60.
Part 3: Debugging Practice
Find and fix the errors in the following code:
- pythonnumber = 10if number = 10:print("Number is 10")
- pythonscore = 85if score > 90:print("Excellent")elif score > 75print("Good")else:print("Needs Improvement")
Part 4: Challenging Problems
FizzBuzz:
- Write a program that take input from the user between 1 to 20.
- For multiples of three print "Fizz" instead of the number.
- For multiples of five print "Buzz".
- For numbers which are multiples of both three and five print "FizzBuzz".
Age Group:
- Prompt the user to enter their age.
- Print "Child" if the age is less than 13, "Teenager" if the age is between 13 and 19, "Adult" if the age is between 20 and 59, and "Senior" if the age is 60 or above.
0 Comments
Please do note create link post in comment section