python how to use any and in code example
Example 1: python3 any
# 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))
# False since iterable is empty
l = []
print(any(l))
Example 2: any function in python
s = input()
print(any(i.isalnum() for i in s))
print(any(i.isalpha() for i in s))
print(any(i.isdigit() for i in s))
print(any(i.islower() for i in s))
print(any(i.isupper() for i in s))