How do I ask to check if someone likes blue?
What if statement do I use?
favorite_color = input("What is your favorite color? ") favorite_color == "blue" Print("You must love the sky")
Cooper Runstein11,797 Points
You need to test if favorite_color is blue:
if favorite_color == 'blue': print("You must love the sky")
You would use what's called an IF conditional statement. In essence, it works just like in the English language. Eg: "If they have cakes at the store, I will get two." The if statement works when the condition given to it is true.
In your case, you would use the condition to see if the input variable is the same as the string "blue".
favorite_food = input ("what is your favorite food?") favorite_food = "pizza" if favorite_food == "pizza" print("You must love the big jay pizzeria down the street.")
Remember, you're using a two equal signs (== ). The two equal signs checks if the two things beside it are equal. The one equal sign (=) just assigns the value on the right to the variable on the left (a=10).