Logic Practice - Answers

if / elif / else practice

Write an if statement that prints "Yay!" if the variable mycolor is "yellow".

Add an elif clause and an else clause to print two different messages for other values of the variable.

Did you write something like this?:

mycolor = "blue"

if mycolor == "yellow":

print("Yay!")

elif mycolor == "purple":

print("Try again!")

else:

print("We want yellow!")