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 trialNiquita Caldwell
167 Pointsit keeps telling me the color i chose is not defined
favorite_color=input('what is your favorite color? ')
color = 'pink'
print("the color", pink, "is a great color!")
2 Answers
Steven Parker
231,198 PointsThe name of the variable you stored your color in is not "pink", but "favorite_color".
Also, you won't need that extra variable named "color".
Louise St. Germain
19,424 PointsHi Niquita!
On the last line, you just need to use the variable name (in this case, favorite_color
) instead of the actual color. The middle line where you give a specific color (pink) is not needed because the first line already collects a color name.
Basically, your first line (from the first part of the challenge) is OK. What it's doing is asking the user what their favorite color is, and storing it in the variable (you can think of it like a box) called favorite_color
.
For the second part of the challenge, it wants you to insert whatever color the user chose into the sentence, and print that to the screen. Again, you have the right structure, but instead of pink
you need to put the name of the variable (favorite_color
). That way, you're telling Python: hey, start by printing "The color ". Then look in the box called favorite_color
to find out what the user said was their favorite color. Print whatever that color is. Then finish off by printing " is a great color!"
It knows to print what is inside the variable (as opposed to the actual words "favorite_color") because variable names don't have any quotation marks around them.
I hope this helps - let me know if it's still not working!