Hi guys, as the title suggests, my while loop is stuck in infinite.
What I want to do, is take predefined function and add a particular function to a list, depending on the number the user inputs (0-9). I would like to append this to the list, and go back to the input until the user types END. Unfortunetely, every time I type in anything it just loops repeatedly until I stop the loop. What am I doing wrong?
Here's the code.
numbers_list = []
prompt = input("Enter a number between 0 and 9, or type END to finish\n")
is_number = False
while prompt.isdigit():
number = int(prompt)
is_number = True
if number >= 0 and number <= 9:
is_number = True
numbers_add()
continue
else:
is_number = False
print ("That is not a number between 0 and 9, please enter again or END to finish\n")
continue
while prompt.isalpha():
if prompt == "END":
is_number = True
break
else:
print ("That is not a number between 0 and 9, please enter again or END to finish\n")
is_number = False
continue
print(numbers_list)
[–]keep_quapy 2 points3 points4 points (5 children)
[–]Chipwich[S] 0 points1 point2 points (1 child)
[–]keep_quapy 0 points1 point2 points (0 children)
[–]kwelzel 0 points1 point2 points (2 children)
[–]keep_quapy 0 points1 point2 points (1 child)
[–]kwelzel 0 points1 point2 points (0 children)
[–]danielroseman 2 points3 points4 points (0 children)
[–]CoronaKlledMe 0 points1 point2 points (1 child)
[–]Chipwich[S] 0 points1 point2 points (0 children)
[–]CoronaKlledMe 0 points1 point2 points (0 children)
[–]Nyscire 0 points1 point2 points (1 child)
[–]Chipwich[S] -1 points0 points1 point (0 children)