Chapter 9: Error and Exception Handling
Types of Errors
print("Hello") # Correct print("Hello" # SyntaxError: unexpected EOF while parsing
result = 10 / 0 # ZeroDivisionError
# Intended to calculate the average total = 100 count = 0 average = total / count # ZeroDivisionError
Handling Exceptions
The else Clause
else ClauseRaising Exceptions
Creating Custom Exceptions
Common Built-in Exceptions
Logging Exceptions
Exercises
Best Practices
Last updated