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

I don't understand what's wrong

It says syntax error but when I look at the code in my workspaces that has the same format it runs fine.

using_variables.py
favorite_color = "red"

print("The color" favorite_color, "is my favorite!")
Ruben Ponce
seal-mask
.a{fill-rule:evenodd;}techdegree
Ruben Ponce
Full Stack JavaScript Techdegree Student 12,035 Points

I don't know Python, but I ran the code like this: // favorite_color = "red"

print("The color " + favorite_color + " is my favorite!") // I am guessing you are just missing the + signs, and don't forget to put spaces in your strings to make the sentence come out good.

2 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Something seems to be missing on this line:

print("The color" favorite_color, "is my favorite!")

After "The color" and before favorite_color. You have the rest of the line correct. Notice anything missing?

Let me know if that hint doesn't do it.

,