0
How to loop input using exceptions
firstly, is this a correct use of exceptions, and if so, how can I properly use them to, say for example, loop input for a password until the correct one is given? I've just learned how to raise exceptions, and could use a little assistance in implementation. https://code.sololearn.com/ci0mBI9Da7hy/?ref=app
1 ответ
+ 1
again = True
while again:
try:
n = int(input())
again = False
except:
print("Bad input, try again")