A ZeroDivisionError
occurs in Python when a number is attempted to be divided by zero. Since division by zero is not allowed in mathematics, attempting this in Python code raises a ZeroDivisionError
.
Here’s an example of a Python ZeroDivisionError
thrown due to division by zero:
a = 10
b = 0
print(a/b)