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

stuck on task 2 on beginner python using_variables.py

Cant get past task 2

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

2 Answers

Majid Bilal
Majid Bilal
3,558 Points

You must watch the lesson again, there must be a usage of format() function and curly braces {} make note of them and use them accordingly.

Mauricio Rumštajn
Mauricio Rumštajn
1,180 Points

In this case, you have two options:

  1. string concatenation

    print("the color " + favorite_color + " is my favorite!")
    
  2. or use string formatting

    print("the color %s is my favorite!" % favorite_color)