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

grant Mitchell
grant Mitchell
6,919 Points

not sure what it is asking.

I feel like I am doing it right. I don't know any other way to do it.

using_input.py
favorite_color = input("what is your favorite color?")


print("The color" +  favorite_color + "is a great color!")

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Grant! I feel like you do understand what it's asking, but you forgot to account for spacing. When running this code in the challenge you can press the "Preview" button to see what test is passing. Note that this is not true for all challenges. But check out the assertion error:

AssertionError: 'Mauve is' not found in 'The colorMauveis a great color!' : Make sure you are printing out 'The color Mauve is a great color!' (Mauve is my favorite)

Take a look at that string. The color is smushed up inside of "color" and "is" with no room to spare. If you use the + signs for concatenation then you need to accommodate for that by including an extra space on either side. Alternatively, you can use the comma to separate the strings to automatically insert a space between each thing.

#Either this
print("The color " +  favorite_color + " is a great color!")

#or this
print("The color", favorite_color, "is a great color!")

Hope this helps! :sparkles: