We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
print(any(char.isalnum() for char in s))#Checks through each character of the string,if even one character is alphanumeric,then returns true,any method iterates throught the sequence and returns true even if one item is true in the iterable
# Check for alphabetic characters
print(any(char.isalpha() for char in s))
# Check for digits
print(any(char.isdigit() for char in s))
# Check for lowercase characters
print(any(char.islower() for char in s))
# Check for uppercase characters
print(any(char.isupper() for char in s))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
String Validators
You are viewing a single comment's thread. Return to all comments →
if name == 'main': s = input()#Takes user input