#Credits to NPTEL MOOC, Programming, Data Structures & Algorithms in #Python by Madhavan Mukund, Chennai Mathematical Institute
while(True):
try:
userdata = input("Enter a number: ")
usernum = int(userdata)
except ValueError:
print("Not a number. Try again")
except NameError:
pass
else:
break
No comments:
Post a Comment