Skip to content

Language

Sign in

Python exceptions: try, except, else, finally: activity sheet

Goal: See which blocks of a try statement run for good input, handled errors and unhandled errors.

You need: Only the simulation is needed. You can repeat it in Python with a short script.

Safety: No special safety needs.

  1. Run int(text) with input 12 and note the blocks.
  2. Run it with abc and the right except clause.
  3. Remove the except clause and note what happens.
  4. Turn finally on and off and say what changes.
My observations
Statement and inputHandlerBlocks that ran

Use your browser's Print option to print this page.

Ask Flint AI
EduFlint: learn and play for free