Exceptions

try / except / else / finally, raising, and custom exceptions

35 min · interactive lesson with runnable code and 6 graded exercises.

What you'll be able to do

  • Say exactly which of try, except, else, finally run — and when
  • Raise, re-raise, and chain exceptions
  • Design a small custom exception hierarchy
  • Choose between EAFP and LBYL

The full lesson is free with an account.

try / except

else and finally

Raising & re-raising

Custom exceptions

EAFP vs LBYL

Common pitfalls