Implement exception handling for the exception_test() function, which is provided and may raise various exceptions.
Specification:
Call the
exception_test()function.Catch and handle the following specific exceptions:
ArithmeticErrorAssertionErrorZeroDivisionError
When an exception is caught, print its name.
Consider the hierarchy of exceptions when structuring your try-except blocks.
Your code structure should look similar to this:
try:
exception_test()
except Exception:
print("Exception")
except BaseException:
print("BaseException")When catching exceptions, remember that a handler for a parent exception will also catch its child exceptions. Therefore, the order of the except blocks is important. Generally, you should catch more specific exceptions before more general ones. For example, consider how ZeroDivisionError relates to ArithmeticError in the exception hierarchy. This relationship should inform the order of your except blocks.