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 (Retired) Things That Count Basic Numbers

input()

getting this error when I try in my local python environment but its working in teamtreehouse workspace

input_string = input("what string do you want? ") input_int = input("how many int do you want? ") print (input_string*int(input_int))

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1 Hello World ^ SyntaxError: unexpected EOF while parsing

2 Answers

'''input_string = input("what string do you want? ") input_int = input("how many int do you want? ") print (input_string*int(input_int))'''

Seems to work fine. The error seems to indicate that may be you are running some other file. "hello World" is from some other code??

Brian Douglas
Brian Douglas
822 Points

This could be to do with your local version of Python.

Try replacing 'input()', with 'raw_input()'.

'raw_input()' works for me with Python version 2.7.6 on a Mac.

I have a feeling that 'input()' works in later versions such as Python 3 and up.