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

Use the favorite_color variable with your print statement to output the following message to the screen :

help!

using_input.py
favorite_color = input('what is your favorite color?')
print('the color, favorite_color, is a great color!')

2 Answers

Your print statements comes out as:

the color, favorite_color, is a great color!

This is because your print statement is just one long string. It should be made up of strings and variables.

Let me know if this helps here

Christopher Thompson
Christopher Thompson
1,406 Points

Remember you can pass a comma separated list of values into the print function and it will print them out in the order that you specify them. The easiest way that Craig showed us how to do this for your question is to pass the three values into print like this (string, variable, string):

print ('the color ', favorite_color, ' is a great color!')

The more complex way he showed us is to use the string format method like this to insert the value of favorite_color into the middle of the string where the curly braces are, probably overkill for this task but may be helpful as you think more about strings and variables.

print ('the color {} is a great color!'.format (favorite_color))