Module 7

Exceptions

When things go wrong.

Errors that happen while running

An exception is an error that happens while a program is running. Unlike syntax errors, exceptions occur when the code is correct but something unexpected happens.

PythonAn exception.
# This would raise a ZeroDivisionError:
# print(10 / 0)

What is an exception?