QuestenaPractice that shows what to review next
Question 96

Which statement correctly distinguishes else and finally in a try statement?

  1. Else needs an exception-free try; finally runs on either outcome.Correct answer
  2. Else handles exceptions that no except clause matches.
  3. Finally runs only when an exception occurs.
  4. Else and finally have interchangeable conditions.

Explanation

The else suite is reserved for the path where the try suite raises no exception, while finally runs as control leaves the construct on either outcome. Treating else as an unmatched-exception handler or finally as exception-only erases their different roles.

Continue with this test

Start practice
Question 96: Which statement correctly distinguishes else and finally in… · Python Fundamentals · Questena