QuestenaPráctica que te muestra qué repasar después
Pregunta 96

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

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

Explicación

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.

Continúa con este test

Empezar la práctica
Pregunta 96: Which statement correctly distinguishes else and finally in… · Python Fundamentals · Questena