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

Sort 1437 Discussions, By:

recency

Please Login in order to post a comment

  • lemahtab
    1 day ago+ 0 comments
    if __name__ == '__main__':
        s = input()
        a, b, c, d, e = False, False, False, False, False
        for i in s:
            if a == False:
                a = i.isalnum()
            if b == False:
                b = i.isalpha()
            if c == False:
                c = i.isdigit()
            if d == False:
                d = i.islower()
            if e == False:
                e = i.isupper()
        print(a,b,c,d,e, sep = '\n')
    
    0|
    Permalink
  • fagnertakeshi
    2 days ago+ 0 comments
    if __name__ == '__main__':
        s = input()
        hasNumber= any(char.isdigit() for char in s)
        hasAlphaNumeric=any(char.isalnum() for char in s)
        hasAnyAlpha=any(char.isalpha() for char in s)
        haslowerCase=any(char.islower() for char in s)
        hasUpperCase=any(char.isupper() for char in s)
        print("True" if hasAlphaNumeric else "False")
        print("True" if hasAnyAlpha else "False")
        print("True" if hasNumber else "False")
        print("True" if haslowerCase else "False")
        print("True" if hasUpperCase else "False")
    
    0|
    Permalink
  • Aurelie123
    2 days ago+ 0 comments

    s = input() if any(ele.isalnum() for ele in s): print(True) else: print(False)

    if any(ele.isalpha() for ele in s):
     print(True)
    else:
     print(False)
    
    if any(ele.isdigit() for ele in s):
     print(True)
    else:
     print(False)
    
    if any(ele.islower() for ele in s):
     print(True)
    else:
     print(False)
    
    if any(ele.isupper() for ele in s):
     print(True)
    else:
     print(False)
    
    0|
    Permalink
  • glaucowow
    4 days 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
  • anirbanwork123
    5 days ago+ 0 comments

    s=input() alpha="False" alphe="False" digit="False" lower="False" upper="False" for i in s: if i.isalnum()==True: alpha="True" if i.isalpha()==True: alphe="True" if i.isdigit()==True: digit="True" if i.islower()==True: lower="True" if i.isupper()==True: upper="True" print(alpha) print(alphe) print(digit) print(lower) print(upper)

    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy