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 task two, any answer i put i got wrong. how is the answer ?

i put different answers but i always get syntax error

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

1 Answer

Pete P
Pete P
7,613 Points

The 'print()' function, prints specified messages to the screen.

  1. You don't want to use print() when assigning "red" to the variable favorite_color.
  2. You also don't want to have quotes around the variable name favorite_color.
  3. When using the print() function you want to insert the variable name into the string you're printing to the screen. The task doesn't want you to explicitly name the color.

One option is to use '+' in your answer.

As an example :

name = 'Pete'
print('Hello ' + name + '!')

This will print to the screen: Hello Pete!