any() Any true
Last updated: 2026-09-22
any() Any true
any() returns True if at least one element of the iterable is truthy; False for empty iterables.
| Category | Built-in Functions |
|---|---|
| Kind | Built-in Function |
| Python Version | all |
📝 Syntax
any(iterable)
⚙️ Parameters
| iterable Required | An iterable (list, tuple, generator, ...). |
|---|
Returns:bool. True if any element is truthy, else False (including empty iterables).
💥 Raises
TypeError— Raised when iterable is not iterable.
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
False
True
False
🏷️ Related Built-in Functions
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhat does any([]) return?
AIt returns False, because an empty iterable has no truthy element — the exact opposite of all([]) returning True.
QDoes any() stop at the first truthy value?
AYes, any() short-circuits: it returns True immediately upon the first truthy element and evaluates no further. Combined with a generator you can avoid extra computation, e.g. any(x % 2 == 0 for x in big_list).
QShould I use any() to check whether a list is non-empty?
AFor checking non-empty, just write if lst: — that is more natural. any() is better for asking whether any element satisfies a condition, e.g. any(x > 10 for x in scores).
Qany() and all() always appear together; how do I remember them without mixing up?
Aany() is OR logic (true if any is true), all() is AND logic (true only if all are true). Memory tip: any() returns False for empty, all() returns True for empty.