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

Python basics 2 - Now write out to the screen The color [YOUR FAVORITE COLOR] is my favorite!

Now write out to the screen The color [YOUR FAVORITE COLOR] is my favorite!, where [YOUR FAVORITE COLOR] is using the variable you created in Task 1. Asking a beginner to do this, what an earth does that mean??

using_variables.py
favorite_color="red"
the coolor("your favorite color")

6 Answers

Thanks for the fast reply that makes a lot more sense print("favorite_color")

Jen Farrant
Jen Farrant
6,905 Points

what Andren said. I sometimes have to watch videos a few times to get the code challenges. They are challenges after all!

Shout out the purest player of all time Andren i was pulling my hair only to find out i missed the comma after 'favorite_comma'. thanks, stay pure!

Now its saying that its wrong ive also tried print("red is my favorite!") and print("the color red is my favorite!"). I've cancelled my membership this isnt for beginners imo,thanks anyway.

andren
andren
28,558 Points

You need to mix the string and the variable, it should not be purely the one or the other.

Like this:

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

This challenge, like most of the beginner challenges, are strongly tied to the code shown in the video directly preceding it. In the previous video you were introduced to variables and to printing out variables and strings together in the way shown above.

While you are certainly entitled to cancel your subscription if you are not satisfied with your experience I would disagree that this particular exercise is a good reason to do so.

Learning how to print out text and how to use variables are almost always the first things thought in programming courses, regardless of language, as they tend to be the simplest concepts to learn in the beginning, and they are both pretty essential going forward in the language as well.

Thanks Andren, was stuck on it.

favorite_color="blue" print("the color", favorite color, "is my favorite!")

Where is my syntax error?

Okay, I understand syntax being a major key in programming, but I never remember the instructor stressing the importance of commas within arguments.