String Validators

Sort by

recency

|

1891 Discussions

|

  • + 0 comments
    python
    if __name__ == '__main__':
        s = input()
        
        checks = [
            any(c.isalnum() for c in s),
            any(c.isalpha() for c in s),
            any(c.isdigit() for c in s),
            any(c.islower() for c in s),
            any(c.isupper() for c in s),
        ]
     
        for check in checks:
            print(check)
    
  • + 0 comments

    I am using it and it's working properly.

  • + 0 comments
    s = input()
        is_alnum = False
        is_alpha = False
        is_digit = False
        is_lower = False
        is_upper = False
    
        for c in s:
            if c.isalnum():
                is_alnum = True
            if c.isalpha():
                is_alpha = True
            if c.isdigit():
                is_digit = True
            if c.islower():
                is_lower = True
            if c.isupper():
                is_upper = True
    
        print(is_alnum)
        print(is_alpha)
        print(is_digit)
        print(is_lower)
        print(is_upper)
    
  • + 0 comments

    if name == 'main': i = input() for s in i: is_alnum = any(x.isalnum() for x in i) is_alpha = any(x.isalpha() for x in i) is_digit = any(x.isdigit() for x in i) is_lower = any(x.islower() for x in i) is_upper = any(x.isupper() for x in i)

    print (str(is_alnum)+"\n"+str(is_alpha)+"\n"+str(is_digit)+"\n"+str(is_lower)+"\n"+str(is_upper))
    
  • + 0 comments

    Took a litle resrearch to find out the correct way :v

    Need to use any() function (built-in) that returns True if at least one element in an iterable is True

    if __name__ == '__main__':
        s = input()
        
        print(any(c.isalnum() for c in s)) 
        print(any(c.isalpha() for c in s))
        print(any(c.isdigit() for c in s))
        print(any(c.islower() for c in s))
        print(any(c.isupper() for c in s))