Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Use input()

Jenna Thompson
Jenna Thompson
759 Points

What is a trailing space?

I'm trying to do the input challenge, when i submit my code it, it says to add in a trailing space. What is that?

age.py
age = input("What is your age?")
Jon Helmus
Jon Helmus
7,312 Points

You need to add a trailing space between the question mark and the final parenthesis.

try this.

age = input("What is your age? ")

1 Answer

You need a space after the question mark.

Currently if the user inputs, it will look like this:

What is your age?28

To put a space between user input and the message, you have to explicitly put it after the question mark.

To fix your code, just do the following:

age = input("What is your age? ")

Notice the space after the question mark. Now when the user inputs it looks much nicer:

What is your age? 28

(28 isn't my age it's just a random age)

Good luck! ~alex