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 (2015) Logic in Python Input

Vineet Tiwari
Vineet Tiwari
6,609 Points

What am I doing wrong? age = int(input("What is your age? "))

In the Python Basics quiz that asks us to convert user input from string to integer I wrote:

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

I get a response saying that it is the wrong answer. What am I doing wrong here?

6 Answers

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

All you need to enter is:

int

Hope this helps!

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Ferdinand is correct. Just the three letters and nothing else. :)

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

Hi Vineet,

What you've got is the right answer, I couldn't tell you why it says it is incorrect, I can only recommend you try it again, maybe check case-sensitivity and make sure you have no white space. This may cause the test to fail.

Hope this helps!

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Vineet,

I'm not sure why it is coming up wrong. Could be a glitch in that one instance, or you somehow added whitespace or a character that wasn't needed.

int is correct answer and passed the quiz when I just tried. Give it another shot. :)

Vineet Tiwari
Vineet Tiwari
6,609 Points

Thank you gentlemen for such a prompt response. I am still haven't passed the quiz unfortunately. In the input field, I entered

int(

the quiz failed. Then I entered

int()

thinking maybe it needs just the function itself, the quiz still failed. At last, I entered the whole line

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

of course it failed. I am starting to feel very stupid.

Have you tried only int as Jason Anders mentioned? Only those 3 letters. It's ok if there's a space afterwards.

The left parenthesis is already there after the input field so you don't want to put it in again by entering int (

Vineet Tiwari
Vineet Tiwari
6,609 Points

Thank you gentlemen, I did not notice the

(

before the

input()

statement.