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")
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

donate a cup of tea :)

Join Our Facebook Group

Share this solution


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube