Q
In Python, which exception is NOT caught by except Exception:?
-
A
KeyboardInterrupt
-
B
KeyError
-
C
ZeroDivisionError
-
D
ValueError
Correct Answer:
A. KeyboardInterrupt
Explanation:
KeyboardInterrupt and SystemExit inherit from BaseException, not Exception.
ALSO KNOW (related points):
• When does the else block of a Python try/except/else statement run? → Only when the try block raised no exception