The Python Game Book

code games. learn Python.

User Tools

Site Tools




This is an old revision of the document!


Return True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to:

def any(iterable):
    for element in iterable:
        if element:
            return True
    return False

any() is part of python's built-in functions

Use any() instead of an expression with a lot of or operators:

en/glossary/a/any.1589358759.txt.gz · Last modified: 2020/05/13 10:32 by horst