Files
Learn-Python-Programming-Th…/ch07/exceptions/multiple.py
T
adii1823 32c12d89f4 ch07
2021-10-28 17:39:13 +05:30

16 lines
307 B
Python

# exceptions/multiple.py
values = (1, 2) # try (1, 0) and ('one', 2)
try:
q, r = divmod(*values)
except (ZeroDivisionError, TypeError) as e:
print(type(e), e)
try:
q, r = divmod(*values)
except ZeroDivisionError:
print("You tried to divide by zero!")
except TypeError as e:
print(e)