Demo entry 6713920

String Validator

   

Submitted by anonymous on Feb 10, 2018 at 18:03
Language: Python 3. Code size: 645 Bytes.

if __name__ == '__main__':
    s = input()
    isalnum=0
    alpha =0
    digit =0
    upper =0
    lower =0
    for i in range (0, len(s)):
        if(alpha==0 or digit==0 or lower==0 or upper==0 or isalnum==0):
            if(s[i].isalnum()):
                isalnum=1
            if (s[i].isalpha()):
                alpha =1
            if (s[i].isdigit()):
                digit=1
            if (s[i].islower()):
                lower=1    
            if (s[i].isupper()):
                upper=1
    print(bool(isalnum))
    print(bool(alpha))
    print(bool(digit))
    print(bool(lower))
    print(bool(upper))

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).