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.

CategoryBuilt-in Functions
KindBuilt-in Function
Python Versionall

📝 Syntax

any(iterable)

⚙️ Parameters

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

Returns:bool. True if any element is truthy, else False (including empty iterables).

💥 Raises

▶ Example

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

Output:

False
True
False
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.
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%

🙏 帮我们做得更好

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

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