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

Anthony Carson
Anthony Carson
138 Points

where do I see the inputs from the user?

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

3 Answers

Hi Anthony,

It looks like you're having trouble with part 2 of the challenge?

In part 2, the teacher writes:

For instance, if I enter "purple" I want your code to print:

The color purple is a great color!

This means that the hard coded "Red" isn't going to work and you have to find a way to make it so that if the teacher types in any color, he will get back the color he wants inserted into the sentence above.

So looking at the code you have...:

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

...let's drop the "Red" part leaving you with:

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

Here, you can simply bring the input statement you already have up to the same line that the favorite_color variable is defined, like this:

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

Also, you will need to remove the quotes from favorite_color in the print statement. For some reason, you will be able to pass task 1 just fine but task 2 requires that you enter the variable name as a variable and not a string. Your finished code should look something like this:

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

Cheers!

I don't get the second part