Lesson 6/6 · Graduation exam preparationNot startedhigh School~60 min

Exceptions (try – except)

A program that does not crash on bad input: asking again for a number, division by zero and several `except` branches.

After this lesson you'll be able to:

  • Catch a `ValueError` when turning text into a number
  • Tell several kinds of errors apart with `except` branches
  • Understand the order of `try`, `except`, `else` and `finally`

Theory (PDF)

The theory for this lesson is being prepared.

Examples to try

Your code runs only in this browser, in an isolated environment with no access to the internet or your account.

Examples for this lesson are being prepared.