Home / Python / Reference / Built-in functions

Python all() function

True if every item is truthy.

Syntax

all(iterable)

Stops at the first False item. all([]) is True: there is no item that fails.

Parameters

iterableitems to test

Return value

bool

Example

Code

scores = [72, 88, 65]
print(all(s >= 50 for s in scores))
print(all(s >= 70 for s in scores))
print(all([]))

Output

True
False
True

Related

Learn it step by step in the free lesson Pythonic Python, with exercises that check your answers.