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 trialDuncan F Kusemwa
168 PointsUse the favorite_color variable in your print function to output the following message to the screen : The color [USER
favorite_color = "purple"
input(favorite_color)
print("The color", favorite_color, "is a great color!")
3 Answers
Sean Layton
1,722 PointsYou first have to prompt the user what his or her favorite color is so you will use favorite_color = input ("what is your favorite color?") then after the user responds it will be stored in favorite_color so then you'll want to print print (" The color {} is a great color!".format(favorite_color))
Jimmy Sweeney
5,649 PointsHi Duncan,
The input() function allows the user to enter in something.
user_name = input()
print(user_name)
When you run the above program, the program will wait for the user to enter something. Then it will print out whatever the user entered. In other words, whatever the user inputted is what will be assigned to the variable "user_name".
You can also add a prompt parameter when you use the input function. So you could do something like:
user_name = input("What is your name? ")
print(user_name)
Again, this will print out whatever the user entered. However, the program will now prompt the user to enter their name. After the user does so, it will print out the name. Hope this helps.
Duncan F Kusemwa
168 PointsThanks Sean