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

17th Sep 2017, 10:34 AM
X-1
X-1 - avatar
1 ответ
+ 1
again = True while again: try: n = int(input()) again = False except: print("Bad input, try again")
17th Sep 2017, 11:13 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar