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
- Understanding Exceptions
- try / except / else / finally
- Raising and Re-raising Exceptions
- Custom Exception Classes