acclivity

pyTryExcept

Nov 15th, 2021 (edited)
1,099
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. while True:
  2.     instr = input("Age: ")
  3.     try:
  4.         age = int(instr)
  5.         break
  6.     except:
  7.         print("Invalid input. Try again\n")
  8. print("Your age is", age)
Add Comment
Please, Sign In to add comment