So, I have this code, works very fine, but I want to have possibility if I input x it will return me to the beginning of choosing list I have
def ask2():
while True:
try:
number = int(input('Pick a number in range 1-100: '))
except ValueError: # just catch the exceptions you know!
print('That\'s not a number!')
else:
if 1 <= number <= 100: # this is faster
print("added")
else:
print('Out of range. Try again')
Aucun commentaire:
Enregistrer un commentaire