Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
basic code help
#1
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?
Reply
#2
name = input('enter name please: ')\
\
print('hello', name) 
get rid of continuation characters
input('enter name please: ')
print('Hello ', name)
Reply
#3
(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"
Reply
#4
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.
Reply
#5
(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!!!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  List index out of range error when attempting to make a basic shift code djwilson0495 4 2,935 Aug-16-2020, 08:56 PM
Last Post: deanhystad
  Writing a basic shift code djwilson0495 2 2,220 Aug-16-2020, 01:52 PM
Last Post: djwilson0495
  Problem with Basic Rock Paper Scissors code BirinderSingh 3 2,388 Sep-13-2019, 03:28 PM
Last Post: ichabod801
  Basic Doubt in code prateek3 6 4,828 Aug-19-2017, 01:05 PM
Last Post: ichabod801
  Need help with basic code Random 6 4,931 Feb-08-2017, 04:56 AM
Last Post: tannishpage
  Basic code help crawlinkingsnake 2 3,432 Jan-16-2017, 11:03 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020