Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialsamuel octelene
1,014 PointsI keep re-watching the video, not sure what i am missing.
.
favorite_color = input("What is your favorite color? ")
print("You must love the sky!")
if favorite_color = "blue"
1 Answer
Alexander Davison
65,469 PointsUnfortunately, 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 print
ing "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!')