try: some code
except XXXError: some code
except YYYError: some code
except ZZZError: some code
…
else: some code(if no exception happen then execute)
finally: some code(always execute)
while True:
try:
name = input('Enter your name:')
year_born = input('Year you born:')
age = 2019 - int(year_born)
print(f'You are {name}. And your age is {age}.')
except TypeError:
print('Type error occur')
except ValueError:
print('Value error occur')
except ZeroDivisionError:
print('zero division error occur')
else:
print('I usually run with the try block')
break
finally:
print('I always run.')