Python Python Basics Meet Python Using Input

Niquita Caldwell
Niquita Caldwell
167 Points

it 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
Steven Parker
163,416 Points

The name of the variable you stored your color in is not "pink", but "favorite_color". :wink:

Also, you won't need that extra variable named "color".

Louise St. Germain
Louise St. Germain
Treehouse Moderator 15,555 Points

Hi 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!