Documentation

Type defined in library builtins

ZeroDivisionError

Python raises a zero division error when when the second argument of a division or modulo operation is zero.

Note that the text of the error message depends on the implementation. Different versions of Python and different checking tools will give slightly different messages.

Code
width / 0
error
ZeroDivisionError: division by zero
Code
5 % 0
error
ZeroDivisionError: integer modulo by zero

Logo of PyTamaro

PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy PolicyPlatform Version a9143b0 (Sun, 14 Dec 2025 12:09:46 GMT)