Python Python Basics Types and Branching Use an if

I keep re-watching the video, not sure what i am missing.

.

branching.py
favorite_color = input("What is your favorite color?  ")
print("You must love the sky!")
if favorite_color = "blue"

1 Answer

Unfortunately, Python doesn't support this syntax:

print("You must love the sky!")
if favorite_color = "blue"

if statements in Python follow the following form:

if <condition>:
    <body>

where <condition> is the condition (in this code challenge, whether or not favorite_color is "blue"), and <body> is the code that is executed if the condition is met. (The body is printing "You must love the sky" onto the screen.)

Also note that you must use == instead of = to test equality. = is reserved for assignment, so you must use ==

Put together the pieces, and you should see...

if favorite_color == 'blue':
    print('You must love the sky!')