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

Where [YOUR FAVORITE COLOR] is using the variable you created in Task 1.

i don't get it

using_variables.py
favorite_color = "red"
The color print(favorite_color) is my favorite!

favorite_color = "Red" print ("my favorite", "color is,") (favorite_color)

why this is wrong?

1 Answer

Hi! how are u? in this challange u have being asked to declare a variable with ur favorite color, this part u were doing wel! in the second part all u need to do is to print to the console the color u have chosen which stroed in favorite_color, ur doing that in a way called formatting.

the working code is:

favorite_color = "red
print("the color {} is my favorite".format(favorite_color))

{} = this is a place holder which will hold the favorite_color variable. .format(favorite_color)) = basically u have to write .format and then open a pair of () and inside them u pass the variable.

if this answer your question please mark as best answer