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

Norah Altamimi
Norah Altamimi
882 Points

What am I doing wrong

using_input.py
input(favorite_color)
print('What is your favorite color?'), ('favorite_color')
Brandon White
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 Points

Hi Norah,

You're really close, but the syntax for printing formatted text is this...

my_variable = "spam"
print("The value {} is stored in a variable named my_variable".format(my_variable))

Hope that helps.

1 Answer

Hello! You are super close however one way to write this would be like this:

favorite_color = input('What is your favorite color?   ') # User inputs blue
print("You're favorite color is {}. ").format(favorite_color)
# Console would show : "You're favorite color is blue."

Input asks the user for a response and usually (but not always) stores that response as a variable. print() just prints out whatever you want the user to see. For example if you wanted it to just print out the user's response you would say:

favorite_color = input('What is your favorite color?   ') # User inputs blue
print(favorite_color)
# Console would show : 'blue'