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

what does that mean ERROR: test_variable_gets_set (__main__.TestCreateAVariableExecution)

using_variables.py
my.py

favorite_color = "Red"

print(favorite_color)

python my.py

6 Answers

Steven Parker
Steven Parker
231,271 Points

I'm not sure what that error means, and I wasn't able to replicate it. But here are some issues relative to the challenge:

my.py                  # <-- this is not a Python statement
favorite_color = "Red"
print(favorite_color)
python my.py           # <-- this is also not a Python statement

Then, after removing the non-Python lines, the code for task 2 isn't complete yet. This code will print the color itself, but the challenge instructions say to print "The color [YOUR FAVORITE COLOR] is my favorite!". So you need to build up and print this larger string that includes the color as part of it.

Okay I'm getting errors

Steven Parker
Steven Parker
231,271 Points

Post the code as it is now. Be sure to use Markdown formatting to preserve the appearance.

Okay

favorite_color = "Red" print("red,"," is my favorite!")

Steven Parker
Steven Parker
231,271 Points

Closer, but they want you to use the variable instead of putting the word "red" again. And the sentence should begin with "The color".

okay thanks

Thanks, man I finally got it right

Steven Parker
Steven Parker
231,271 Points

Likuwa Kadhira — Glad to help. You can mark the question solved by choosing a "best answer".
And happy coding!