Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics Meet Python Using Input

Not sure what I'm doing wrong

Bummer: : Hmm...I answered the prompt with 'Red' but that's not what was in the variable favorite_color

I keep getting this error and I redid the challenge before this one but still get the same error message

favorite_color = input("What is your favorite color? ")
favorite_color = "purple"
print("The color",  favorite_color, "is a great color!")

@Craig Dennis

4 Answers

Paisley Myers
Paisley Myers
209 Points

I think it will work if you take out the second line. You are defining favorite_color twice.

Craig Dennis
Craig Dennis
Treehouse Teacher

Yeah don't re-define the color to purple...I call your script and fill in the prompt...that sets favorite_color to what I entered.

That make sense?

Christian Berglönn
Christian Berglönn
3,274 Points

As Paisley says, you're already letting the user define favorite_color with your input statement. By defining favorite_color again with "purple" probably just messes it up. Try removing favorite_color = "purple" and it probably will work.


props to Paisley Myers figured it out the red confused me because I put red for the other challenge before this one thanks guys