Exception Handling

Exception handling in Python is done using try, except, and finally.

Example:

try:
    num = 10 / 0
except ZeroDivisionError:
    print("Cannot divide by zero!")
finally:
    print("This will always execute.")

Output:

Cannot divide by zero!
This will always execute.