HackerRank String Validators Problem Solution. Use of isalnum(), isalpha(), isdigit(), islower(), isupper() functions of string.
Code:
if __name__ == '__main__':
s = input()
print(any(c.isalnum() for c in s))
print(any(c.isalpha() for c in s))
print(any(c.isdigit() for c in s))
print(any(c.islower() for c in s))
print(any(c.isupper() for c in s))
Test Input:
qA2
Test Output:
True
True
True
True
True