PyPython Lab

Stage 2 · 25 minutes · Pro

Error handling with try / except

Catch errors while a program runs: try, except ValueError, ZeroDivisionError, else, finally and raise.

Objectives

Lesson for Pro members

Users will type wrong input: letters when a number is needed, division by 0. A good program does not 'crash' but reports the error clearly and keeps running.

View Pro plans Open in the app