Skip to content
Built-in Functions

any()

Check whether at least one item in an iterable is truthy.

any(iterable)

any() returns True if at least one element in the iterable is truthy.

It short-circuits and returns True immediately upon encountering the first truthy element. Returns False on empty iterables.

Parameters

NameDescription
iterableA collection or other iterable of values to check.

Returns

True if at least one item is truthy; otherwise False.

Try it

Run it and change it
answers = [0, "", False]
print(any(answers))

Worth knowing

  • Short-circuit efficiency: Does not evaluate subsequent items once a truthy element is found.

Related entries