Practice: If Else
Time to practice if-else and write a code on it
💡 This excercise will put everything in action you have learned so far on if-else-
💡 Write a code below
Task: Write a program to check if the user prefers Ice Cream or Cake
Task: Create variable name dessert. Set its value to either "cake" or "icecream"
Hint: If they like "icream", print "Yay! Ice cream is cool! 🍦
If they like cake, print "Yum! Cake is delicious! 🎂
**Hint: Use flip card to see solution if you are not able to complete **
**Hint: Remeber to use double '==' signs for comparing. **
Type code below in textbox
Output:
Click to Reveal Solution
dessert = "cake" if dessert == "icecream": print("Yay! Ice cream is cool!") else: print("Yum! Cake is delicious!")