Python · Lesson 9.2 · Pro

else and finally

Code that runs only when nothing went wrong, and code that always runs.

In this lesson

  1. Several kinds of error
  2. else: only if it worked
  3. finally: always runs
  4. Keep the try small