Out of the following statements, which one is incorrect in the context of exceptions in Python?
Out of the following statements, which one is incorrect in the context of exceptions in Python?
Solution
✅ Correct Option: 2
Option 2 is incorrect because the else block does not catch anything. In Python, an exception raised in the try block is caught and handled by the matching except block. The else block runs only when the try block finishes with no exception.
Option 3: this one is a trap. Exceptions are raised inside try, and the try/except pair catches them. This is the usual textbook wording, so it is treated as correct.
Option 4: finally always runs, whether or not an exception occurred.
Memory trick: else means "else, if no exception occurred".