HackerRank Python Problem - String Validators

HackerRank Python Problem:

Question: You are given a string S.

Your task is to find out if the string S contains: alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters

Solution:

if __name__ == '__main__':
    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))

Comments

Popular posts from this blog

THREE LEVELS OF DATA INDEPENDENCE

Python Syntax, Comments, Variables, Indentation

Python-HackerRank Problem List Comprehensions