Python Forum
Imported function causes prompt repetition
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Imported function causes prompt repetition
#4
I believe that more traditional way is micseydel other suggestion (more concise):

def getFloat(prompt):
    while True:
        try:
            return float(input(prompt))
        except ValueError:
            print('That is not a number -- please try again')
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: Imported function causes prompt repetition - by perfringo - Feb-06-2019, 02:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to make the function to prompt the user repeatedly till he enters a no sbabu 3 2,424 Mar-26-2020, 10:04 PM
Last Post: Blackdog31
  Finding repetition in string student8 4 5,060 Oct-15-2017, 07:26 PM
Last Post: student8

Forum Jump:

User Panel Messages

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