In a string if at least one lowercase, uppercase , number and special character exists it should print true or else false

def solution(a):
    s1=a.strip()
    for i in s1:
        k=i.islower()
        s=i.isupper()
        l=i.isnumeric()
        if k == True and s == True and l == True:
            print('True')

        elif l != True and s!= True and k!=True:
             print('False')

a="Hp1"
solution(a)

For now above function contains checking for uppercase,lowercase & number .But While running above script i'm not getting any output. Please help and advance Thanks.



Read more here: https://stackoverflow.com/questions/67379584/in-a-string-if-at-least-one-lowercase-uppercase-number-and-special-character

Content Attribution

This content was originally published by SrinivasRaj at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: