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 trialGia Hoang Nguyen
4,137 PointsCode Challenge! I cant pass the second task question.
favorite_color = "Purple"
print=(favorite_color)
Getting message: AssertionError: 'Purple' not found in 'favorite_color' : Make sure you print out 'The color Purple is my favorite!'
3 Answers
Louise St. Germain
19,424 PointsYou have correctly assigned "Purple" to the variable favorite_color using the = sign.
However, print is a function, not a variable, so you put the parentheses right after it, with no = sign, like this:
favorite_color = "Purple"
print(favorite_color)
Note also that the question is asking for you to put the whole sentence 'The color Purple is my favorite!', not just the color by itself. You have the right idea with being able to print the contents of the variable ( = "Purple"), but you also need to put the rest of the sentence around it, like this:
favorite_color = "Purple"
print("The color", favorite_color, "is my favorite!")
This will print "The color ", and then the value of the variable favorite_color, which is "Purple", and then will print " is my favorite!". If you review the video, you will see that Craig does something similar when he customizes a printed message with his first_name variable. Hope this helps!
gstarks2
2,594 PointsThanks Louise. Your answer is correct.
gstarks2
2,594 PointsThanks Louise for the correct answer.
Yamil PΓ©rez
Courses Plus Student 2,054 PointsYamil PΓ©rez
Courses Plus Student 2,054 Pointsit will always an error because you never can do this print = (favorite_color) , add to your print statement equal signThe right way like print (favorite_color).
you code have to look like; favorite_color = "Purple" print(favorite_color)