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

favorite_color = "Mauve"

using_input.py
favorite_color = input("What is your favorite color?")

print("The color {} is a great color!".format(favorite_color))

2 Answers

Hi Pandu!

Sometimes the challenge test program is brutally unforgiving...

favorite_color = input("What is your favorite color? ") # You are missing the space after the question mark

print("The color {} is a great color!".format(favorite_color))

Sometimes it helps to actually copy and paste the example text to get it right.

In this case, the space after the question mark is necessary or it won't look right to the user when he/she is prompted and types his/her answer.

When the code is running, without the space, he/she would see:

What is your favorite color?blue [user hits enter]

When what you want it this:

What is your favorite color? blue [user hits enter]

Does that make sense?

I hope that helps.

Stay safe and happy coding!

Hi Pandu!

One limitation of the Treehouse challenges is that you can't always see how the code they have you write actually runs.

So I often go here:

https://www.katacoda.com/courses/python/playground

To test it for myself; to see if it behaves as I imagine it should!?!

I hope that helps.

Stay safe and happy coding!