Structured Exception Handling
Mon 10 August 2026
def divide(a, b):
try:
return a / b
except ZeroDivisionError:
return "Division by zero error"
except TypeError:
return "Invalid input type"
print(divide(10, 0))
Division by zero error
Score: 10
Category: chapter6_exception_handling
Read More