# AssertionError

*noun*

say it: **“uh-SUR-shun AIR-er”** **/əˈsɝʃən ˈɛrər/**

The error Python gives when a check written with assert turns out to be false, with the message the check carries.

## What is an **AssertionError** in Python?

An **AssertionError** is the error Python raises when an `assert` statement's condition is False. It carries the
message written after the comma, so the error says what went wrong; when the condition is True, nothing happens.

```python
assert readings["humidity_pct"].between(0, 100).all(), "humidity must be 0 to 100"
# AssertionError: humidity must be 0 to 100
```

## In a sentence

- “The cleaning stopped with an **AssertionError**: humidity must be 0 to 100.”
- “An **AssertionError** means a check you wrote found something false.”

Level: Apprentice · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=2)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/assertionerror
