Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie help with input
#5
I'm running 3.7.4

Type in
v=input("Enter value: ")
print (v)

result:

>>> v=input("Enter value: ")
Enter value: print (v)

It isn't waiting for input.

Per Yoriz, I paste in "v=input("Enter value: ")", type in input, then paste "v=input("Enter value: ")"

Yes, it prints v correctly. It gets the input.

But I'm not clear how this helps me write a script in which I need user input. It doesn't wait. It just moves on to the print command.

Does anyone have something that works for you, that I can paste in to test?

Correction:

Per Yoriz I paste "v=input("Enter value: ")", input, and then "print (v)".

It gets the input, but in a script it doesn't wait, it just moves on to the next command.

I'm brand new to Python. I may have some major misconception about input.

1. It displays the print(v) command but doesn't execute it.
2. When I manually type in the print command, I see it has received the value.

I don't understand. Why doesn't it wait for input and then executes the print command?

>>> v=input("Enter value: ")
Enter value: print (v)hi there
>>> print (v)
print (v)hi there
>>>

(Aug-28-2019, 10:16 PM)jefsummers Wrote: The code is correct, but somehow you have a problem with the end of line of the first line. I cut and pasted the code and got an error
Error:
SyntaxError: multiple statements found while compiling a single statement
with a big red line going out from the first line.
Don't know what you did, but somehow in your editing you messed the line ending up.

I hit Return like every other line of my script, and it all runs. Just not the input command.

What do I do to correct the EOL?


Thanks for reply.
Reply


Messages In This Thread
Newbie help with input - by LouK - Aug-28-2019, 09:10 PM
RE: Newbie help with input - by jefsummers - Aug-28-2019, 10:16 PM
RE: Newbie help with input - by Yoriz - Aug-28-2019, 10:21 PM
RE: Newbie help with input - by Malt - Aug-29-2019, 05:59 AM
RE: Newbie help with input - by LouK - Aug-29-2019, 02:00 PM
RE: Newbie help with input - by perfringo - Aug-29-2019, 03:34 PM
RE: Newbie help with input - by LouK - Aug-29-2019, 05:38 PM
RE: Newbie help with input - by LouK - Aug-29-2019, 06:50 PM
RE: Newbie help with input - by LouK - Aug-29-2019, 08:41 PM
RE: Newbie help with input - by onlydibs - Dec-22-2019, 04:12 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Big Grin Newbie to Python - input and branching issue Sherine 3 2,341 Jul-31-2021, 01:09 AM
Last Post: Pedroski55
  Newbie ? Python 3 Input() jlgrunr 1 2,537 Feb-17-2018, 10:26 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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