QuestionQ68

VerifiedExceptions

What is the expected result of running the following code?

Question Image

Explanation

ZeroDivisionError is a subclass of ArithmeticError. The inner handler increments the global value from 0 to 1 and re-raises the exception; the outer ArithmeticError handler then adds 2, so the printed value is 3.

Community Discussion

No comments yet. Be the first to start the discussion!