The any() function takes an iterable (list, string, dictionary etc.) in Python.
The any() function returns the boolean value:
True if at least one element of an iterable is true
False if all elements are false or if an iterable is empty
Example:
some_list = [1, 2, 3]
print(any(some_list)) # True
another_list = []
print(any(another_list)) # False
# True since 1,3 and 4 (at least one) is true
l = [1, 3, 4, 0]
print(any(l))
# False since both are False
l = [0, False]
print(any(l))
# True since 5 is true
l = [0, False, 5]
print(any(l))
# All elements of list are true
l = [ 4, 5, 1]
print(any( l ))
# All elements of list are false
l = [ 0, 0, False]
print(any( l ))
# Some elements of list are
# true while others are false
l = [ 1, 0, 6, 7, False]
print(any( l ))
# Empty List
l = []
print(any( l ))
# All elements of tuple are true
t = (2, 4, 6)
print(any(t))
# All elements of tuple are false
t = (0, False, False)
print(any(t))
# Some elements of tuple are true while
# others are false
t = (5, 0, 3, 1, False)
print(any(t))
# Empty tuple
t = ()
print(any(t))