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.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Python
  3. Strings
  4. String Validators
  5. Discussions

String Validators

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • glaucowow
    2 months ago+ 0 comments

    def apply_func(x,func): return eval(f"x.{func}()")

    def apply_string(x,func): for i in range(len(x)): if apply_func(x[i],func) == True: return True return False

    if name == 'main': s = input() print(apply_string(s,'isalnum')) print(apply_string(s,'isalpha')) print(apply_string(s,'isdigit')) print(apply_string(s,'islower')) print(apply_string(s,'isupper'))

    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy