AI engineering glossary · Python core
What is zeroDivisionError?
ZeroDivisionError: A built-in exception raised when a number is divided, floor-divided or reduced by modulo with zero as the divisor. It is a common bug when computing averages or ratios over empty data, and it is easy to guard against with a check.
ZeroDivisionError: an example
total / count raises ZeroDivisionError when count is 0, so check if count: first.
Related terms
More Python core terms
Where you learn it
ZeroDivisionError is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.