Python Forum
Sorry to bother, I've occured a newbiw question.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sorry to bother, I've occured a newbiw question.
#2
(Aug-30-2019, 04:25 AM)Ethan4216 Wrote: I typed "a = int(input())" and press "Enter" to make a new statement, the prompt didn't show up.

Are you sure that prompt didn't show up? As you have no text for input to display it can be easily missed (empty row without >>> at the beginning).

To make it more prominent you should use text:

>>> a = int(input('Please enter integer: '))
Please enter integer: 
As of ValueError while copying: Python interactive interpreter interprets code line by line. This means that after line a = int(input()) it displayed input prompt and then entered into it next line b = int(input()). You can observe it yourself (note line without starting >>>)

>>> a = int()
>>> b = int()
>>> a = int(input())
b = int(input())                      # value entered into prompt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'b = int(input())'
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
RE: Sorry to bother, I've occured a newbiw question. - by perfringo - Aug-30-2019, 04:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  why this error occured in recursion ashishraikwar 1 1,807 Apr-24-2020, 11:12 AM
Last Post: buran
  'Exception Has occured: UnBoundLocalError' caston 1 2,500 Jun-12-2019, 02:33 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

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