HackerRank- Python String Validators



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.



  1. if __name__ == '__main__':
  2. s = input()
  3. res = ["False", "False", "False", "False", "False"]
  4. for i in s:
  5. if i.isalnum():
  6. res[0] = "True"
  7. if i.isalpha():
  8. res[1] = "True"
  9. if i.isdigit():
  10. res[2] = "True"
  11. if i.islower():
  12. res[3] = "True"
  13. if i.isupper():
  14. res[4] = "True"
  15. print(*res, sep="\n")

download android app