PRACTICE / UNDERSTAND / REPEAT

Python: Exceptions

Practice exceptions with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

19 questionsAnswers explainedFree · no login
Question 1 of 19
Exceptions · MCQQuestion link ↗

Which clause runs only when the `try` block raises no exception?

Choose one answer
Answer & explanation

Answer: else

`else` runs if no exception occurred. `finally` runs regardless of success or failure.