0Pricing
Python Academy · Lesson

Understanding Exceptions

Learn what exceptions are and how Python raises them.

Introduction

Exceptions are Python's mechanism for signalling and handling errors at runtime.

What is an Exception?

An exception is an event that disrupts normal program flow. Python raises exceptions when errors occur — e.g., dividing by zero.
# 1 / 0  # raises ZeroDivisionError
print('exceptions demo')

All lessons in this course

  1. Understanding Exceptions
  2. try / except / else / finally
  3. Raising and Re-raising Exceptions
  4. Custom Exception Classes
← Back to Python Academy