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 trial

Python Python Basics Meet Python Using Input

Python "inputs"

I am working on the Python basics and in the input section it keeps changing the answer.

using_input.py
favorite_color = input("What is your favorite color?  ")
favorite_color = "Mauve"
print("The color", favorite_color, "is a great color!")

When I use the color "Red" in my code it comes back with the color "Mauve" and that it is wrong. Ok So I use "Mauve" and it comes back with the color "Red" and tells me it is incorrect? How am I supposed to know what color it is going to be ?? Doesn't make any sense !!

1 Answer

Hi Michael,

The problem is with the second line in your code. It’s important for this challenge to understand what this input function does.

When your program runs, the user will be asked what his/her/their favorite color is (this is due to the input function, which logs/prints a string to the terminal and then waits for user feedback). In this case, the user is the Test program that Treehouse is using. In one instance the test program responds to the input function with Red. And so Red becomes stored in the favorite_color variable, but then on the second line of your code, you change the value of what’s stored in the favorite_color variable to Mauve.

As such, when you print the compounded string to the terminal, the string is different than what the test program is expecting.

In this challenge, you are not to hard code a value into the favorite_color variable. Remove the second line, and your code will pass.

Good luck, coder!