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

I'm stumped...I don't understand what to put. Can anyone explain to me what the question is asking me to input?

Input the favorite color is great!

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

2 Answers

Brandon Oakes
seal-mask
.a{fill-rule:evenodd;}techdegree
Brandon Oakes
Python Web Development Techdegree Student 11,501 Points

So for the first part you used the input() function to ask a user what there favorite color was, and there answer was stored into the variable favorite_color. Next you need to place your variable (favorite_color) which stores the users answer into a sentence and display it using the print() function. You do this but using concatenation: The code below worked for me.

favorite_color = input('What is your favorite color?')

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

Thank you sir! Everything I tried wouldn't work and the "+" was never mentioned in the videos.

Craig Dennis
Craig Dennis
Treehouse Teacher

It's looking for the multiple arguments to the print method. Remember how we did that with first_name in the video?

first_name = input("What's your first name?")
print("Hello", first_name)

I let multiple ways of printing the answer pass, I am expecting you to use the multiple argument style here, but the + which we'll get to here in a bit also works.

That help?