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 Using Input

Bummer: SyntaxError: invalid syntax Challenge Task 2 or 2 feeling REALLY dumb over here.

I thought if the text turned "green" I was on the right track?? This is just not sticking. I wrote everything down and I'm reviewing my notes. Is it normal to get stuck on a task like this for an hour... losing confidence but determined!

input ("What is your favorite color?")
favorite_color = input("What is your favorite color?")
favorite_color = purple
print ("The color,"favorite_color",is a great color!")

2 Answers

Alan Ayoub
Alan Ayoub
40,294 Points

Hi Kristian,

I totally understand your frustration, do not give up!

First, I see you have extra lines of code on line 1 and line 3. I'd delete those. You came really close to getting the print statement correct, you were only missing commas before and after the variable favorite_color (your code included the commas within the string, they need to be outside of the string).

Anyhow, here is what the working code looks like!

# input function stored in a variable
favorite_color = input("What is your favorite color?")

# prints out the users favorite color
print ("The color",favorite_color,"is a great color!")

I hope that helps, and keep pushing forward!

Thank you kindly,

Very helpful! I appreciate your time.