String built-in validators | HackerRank

admin
By -
0

 

String validators

the question is not fully clear  we have to check each character of string with using built -in validators and check string containing any of element to  related that validator 


Question Link: https://www.hackerrank.com/challenges/string-validators/problem


Simple Code Solution:

 print(any(c.isalnum() for c in s))  # alphanumeric: should return True

    print(any(c.isalpha() for c in s))  # alphabetic: should return True

    print(any(c.isdigit() for c in s))  # digit: should return False

    print(any(c.islower() for c in s))  # lowercase: should return True

    print(any(c.isupper() for c in s))  # uppercase: should return False

Post a Comment

0Comments

Put Your Thought or Query Here

Post a Comment (0)