# ValueError

*noun*

say it: **“VAL-yoo AIR-er”** **/ˈvælju ˈɛrər/**

The error Python raises when a function gets a value of the right type that it can't use, such as int("twelve").

## What is a **ValueError**?

A **ValueError** is the exception Python raises when a value is the right type but can't be used, such as text that
isn't a number given to `int()` or `float()`. Your own functions can raise it for a bad value too.

```python
price = float("two")
# ValueError: could not convert string to float: 'two'
```

## In a sentence

- “The kiosk catches the **ValueError** and asks for the hours again.”
- “Typing 'ten' at the parking kiosk caused a **ValueError** when the code turned it into a number.”

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/valueerror
