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

Sara graziano
Sara graziano
151 Points

i got stuck with variables

i got stuck with variables in python i am supposed to output "the color green is my favorite!"

2 Answers

Hi, can you post the code/question given? Somewhere on this page should be 'Markdown Cheatsheet' which shows how to add code like this:

my_color = input("What is you're favourite colour?")
print("the colour {} is my favourite".format(my_color))
Rick Gleitz
Rick Gleitz
47,876 Points

I think you are closer to the beginning than Robert's methodology (which you will learn later).

In this case they want you to separate the string into two parts with the variable in between:

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

See how the variable you named previously goes in between the two strings in the print statement?

That should print this: The color green is my favorite!

(provided you chose green for the value of your variable).

Hope this helps!