ask user age

PHOTO EMBED

Sun Jan 16 2022 12:17:53 GMT+0000 (Coordinated Universal Time)

Saved by @armin10020

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")
content_copyCOPY