0

I'm using the book "Python In Easy Steps" by Mike Mcrath,and I'm having a issue with the user input project. I keep getting the error "multiple statements found while compiling a single statement".

user = input('Hello, my name is Hal. What is your name?:')

print( ' It is very nice to meet you',user)

I'm using the 3.4.3 version of the IDLE shell to test my code.

Hybris
  • 19
  • 3

3 Answers3

2

You need to execute them one by one :

user = input('Hello, my name is Hal. What is your name?:')

it will ask for input and then:

print( ' It is very nice to meet you',user)

or create a Python script (.py) and then from terminal exexute:

python filename.py
Navneet
  • 4,543
  • 1
  • 19
  • 29
  • IDLE can only do a single statement at once, i.e. in your case: A single line. So you have to paste in all lines individually and execute them. – Navneet Jul 14 '15 at 07:50
0

Try this:

print ('It is very nice to meet you %s' % user)
Joe T. Boka
  • 6,554
  • 6
  • 29
  • 48
0

print 'It is very nice to meet you %s' % user

sinhayash
  • 2,693
  • 4
  • 19
  • 51
  • I did not know IDLE could only do one statement at a time. I ran it from the Terminal a few other times and got the same error, but this time it worked. I guess I needed to mess around with the indentations in Notepad. Thanks for the help guys. – Hybris Jul 14 '15 at 08:16