RJFalconer
0
Q:

any 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))
1
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
1

New to Communities?

Join the community