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).

CategoryBuilt-in Functions
KindBuilt-in Function
Python Versionall

📝 Syntax

all(iterable)

⚙️ Parameters

iterable RequiredAn iterable (list, tuple, generator, ...).

Returns:bool. True if all elements are truthy (or the iterable is empty), else False.

💥 Raises

▶ Example

Edit the code, press Run, and see the result in the output panel:

Output:

True
False
True
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.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏