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

Aleksandra Ivanova
Aleksandra Ivanova
279 Points

Where to use quotation marks?

I do understand they are needed inside parenthesis when they are an argument, per say, of some function. But if I just need to write a line of a text, where I am using variable, what should be in the quatation marks "" ?

using_variables.py
favorite_color = "gray"
"The color" favorite_color "is my favorite!"

1 Answer

Steven Parker
Steven Parker
229,732 Points

The quotes are in the right places; but to output a message, the whole thing should be passed as the argument to a "print()" function.

Also, the strings and variable name should be separated either by commas (to make them individual arguments) or by plus signs ("+", to concatenate them into a single string).