any() in Python


Python tip:

You can use any to check whether any element inside an iterable has a truthy value.

An example👇

platforms = ["Facebook", "Twitter", "Instagram"]

print(any(platform == "Twitter" for platform in platforms))
# => True

print(any([]))
# => False

print(any([2, 3, 4]))
# => True