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 Create a Variable

Stephen Bruen
Stephen Bruen
3,304 Points

I've looked at all the help articles and not sure what's wrong here?

I've tried copy and pasting the answers. I've tried it myself. Not sure what's wrong here?

using_variables.py
favorite_color = input("What is your favorite color? ")
print("The color", favorite_color, "is a great color!")

first line : they are asking to set your favorite color in the variable favorite_color, they are not asking to ask the user his favorite color. So just set variable favorite_color and put you favorite color in a string second line : you need to join the string with the sign + instead of comma.

3 Answers

You're not incorrect in what you've done apart from the fact that you're asking for an input, when what they want you to do is to hard code the variable instead. So setting the variable "favorite_color" to any string would work and complete the task.

favorite_color = ("Your Favorite Color")
print("The color %s is a great color!"%favorite_color)

favorite_color = "blue" print("The color %s is a great color!" %favorite_color)

favorite_color = "blue" print("The color "+favorite_color +" is a great color!")

favorite_color = "red" print("the color %s is my favorite!",favorite_color) that is the code