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

Caitlin Blaney
Caitlin Blaney
114 Points

I've been stuck on this variables question for a week... what is the answer supposed to be?

using_variables.py
favorite_color = "blue"
print("The color", favorite_color, "is my favorite!")

3 Answers

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Data Analysis Techdegree Graduate 49,443 Points

I would try just adding spaces at the end of the first string and beginning of the second. These challenges can be extremely picky so always try to double check things like this.

Also, please don't stress yourself and wait so long to ask for help! You essentially had this right so don't feel discouraged! Just a picky challenge is all.

favorite_color = "blue"
print("The color ", favorite_color, " is my favorite!")
Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,850 Points

Is the challenge failing? I just copied/pasted your code and it passed without any changes.

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Data Analysis Techdegree Graduate 49,443 Points

Clayton Perszyk , Do you mean you copied mine or Caitlin's code?

If you copied mine, it's because like I said, I added spaces after "color" and before "is". Without the spaces it would print like

The colorblueis my favorite!
Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,850 Points

Travis Alstrand I copied Caitlin's directly... and I get "The color blue is my favorite!"

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Data Analysis Techdegree Graduate 49,443 Points

Yes you're right, I just tried it as well! 🤯

Somebody must have adjusted the test with this challenge since this was posted to be more lenient haha. 🎉