import sys age = input("how old are you?") # age = str while age != int: try: # global age |: #niazi be Global nist fek konam age = int(age) break except: print(f"type error{sys.exc_info()[0]}") age = input('your input should be "integer",try again: ') print(f"you are {age} years old")
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter