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 have no idea as to the answer to this question . please help

using_input.py
favorite_color = input ("what is your favorite color")
print(input("Blue is my favorite color")

4 Answers

can you help with this question . thanks

Use the favorite_color variable in your print function to output the following message to the screen :

The color [USER INPUTTED COLOR] is a great color! I will respond with my favorite color when I run your script.

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

Steven Parker
Steven Parker
229,785 Points

Your first line was good for task 1, and that's the only "input" you'll need.

For task 2, print the phrase using "format" to substitute the user's color (you won't know what it is) into the message. You'll use a placeholder {} where the color will go, and pass the variable from task 1 to the "format" call.

Joshua Carroll
Joshua Carroll
137 Points

Im struggling with this too, I must have missed a video regarding format variables and placeholders...ugh Thanks for the help

i still do not understand. can you just write the answer and tell me for now. thank you

Scott Bailey
Scott Bailey
13,190 Points
favorite_color = input("What is your favorite color? ")

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

You already have the color from the input saved into the variable 'favorite_color'. So all you need to do is wrap the variable around the string.