Python Forum

Full Version: basic code help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
code:

name = input('enter name please: ')\
\
print('hello', name)

I'm using python 3 shell and I cant get it to work. I get an error message each time. What I can do to fix this?
name = input('enter name please: ')\
\
print('hello', name) 
get rid of continuation characters
input('enter name please: ')
print('Hello ', name)
(Feb-17-2018, 09:38 PM)Larz60+ Wrote: [ -> ]
name = input('enter name please: ')\
\
print('hello', name) 
get rid of continuation characters
input('enter name please: ')
print('Hello ', name)
Pray

this is the error i get when I did what you said

"SyntaxError: multiple statements found while compiling a single statement"
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> input('enter name please: ')
print('Hello ', name)
SyntaxError: multiple statements found while compiling a single statement
>>> 
In interactive shell one line at the time with <Enter>.
>>> name = input('enter name please: ')
enter name please: Kent
>>> print('Hello ', name)
Hello  Kent
To Run as script.
[Image: Wn7asS.jpg]
IDLE is not good,look at forum there are many discussion about IDE/Editors/REPL.
(Feb-17-2018, 10:15 PM)snippsat Wrote: [ -> ]
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> input('enter name please: ') print('Hello ', name) SyntaxError: multiple statements found while compiling a single statement >>> 
In interactive shell one line at the time with <Enter>.
>>> name = input('enter name please: ') enter name please: Kent >>> print('Hello ', name) Hello Kent
To Run as script. [Image: Wn7asS.jpg] IDLE is not good,look at forum there are many discussion about IDE/Editors/REPL.
Thank you! it makes sense now!!!