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 trialAndre Davis
3,647 Points'What is your favorite color?' challenge task 2 of 2 in python basics I don't understand how to get the answer
I'm way off track I've been trying two weeks no kidding please help me understand!
3 Answers
Daniel Vega
2,290 Pointsfavorite_color = input("What is your favorite color?")
print("The color {} is a great color!".format(favorite_color))
Dylan Chuckry
2,841 PointsIt is asking us to store the user input into a variable.
First we need to declare the variable and give it an '=' symbol to give the variable an identity. We write: favorite_color =
then, we need to define what the variable actually means. The challenge asks to as for a user input which means we need the 'input()' function. The paramerters (the perenthisies) will prompt the user with what you put in it. we write: favorite_color = input("What is your favorite color?")
Now we have a variable named 'favorite_color' and it will equal whatever the user enters upon being prompted.
This is what the line of code should look like in the editor:
favorite_color = input("What is your favorite color?")
Hope this helps! Feel free to ask any questions if you need any clarification.
cosmas mwirigi
1,381 Pointsthe answer is simple but i kept using print even after declaring the variable correctly. silly me :)
favorite_color = input("What is your favorite color?")
Juliette Delannoy
1,112 Pointsand how you expected that answer because they didn't ask us to write.. favorite_color = input("What is your favorite color?") or something similar, just trying to know you thought about the answer lol thanks!!!!!