Chapters
Python114 chapters

ReferenceBuilt-in functions

all()

True when every item is truthy, and True for an empty iterable.

Signature

all(iterable)

Parameters

NameMeans
iterableany sequence or generator

Returns

A bool. It stops at the first falsy item.

Example

Python
print(all([True, True]))
print(all([True, False]))
print(all([]))
print(all(n > 0 for n in [1, 2, 3]))

Output

True
False
True
True

See also