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.

Level: beginnerTopic: Python core

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.