all() All true
Last updated: 2026-09-22
all() All true
all() returns True only if every element of the iterable is truthy (or the iterable is empty).
| Category | Built-in Functions |
|---|---|
| Kind | Built-in Function |
| Python Version | all |
📝 Syntax
all(iterable)
⚙️ Parameters
| iterable Required | An iterable (list, tuple, generator, ...). |
|---|
Returns:bool. True if all elements are truthy (or the iterable is empty), else False.
💥 Raises
TypeError— Raised when iterable is not iterable.
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
True
False
True
🏷️ Related Built-in Functions
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhat does all([]) return, and why?
AIt returns True. An empty iterable contains no falsy element, so by definition (all elements are truthy) an empty set is vacuously true.
QWhat is the difference between all() and any()?
Aall() requires every element to be truthy (empty returns True), while any() returns True if at least one element is truthy (empty returns False); their results on an empty iterable are exact opposites.
QCan I use all() to check whether a list contains 0 or empty strings?
AYes, all([1, 0, 3]) returns False. Note that all() only judges truthiness (0, '', None are all falsy) and does not check types.
QWhat happens if all() is passed a non-iterable (such as a number)?
AIt raises TypeError: 'int' object is not iterable; all() requires its argument to be an iterable.