+1

What's wrong with the code?

It works very well but just doesn't work with case 4 import string pw=list(str(input())) x=list(string.punctuation) t=['1','2','3','4','5','6','7','8','9','0'] p=[i for i in x if i in pw] j=[i for i in t if i in pw] if len(p)>=2 and len(j)>=2 and len(x)>=7: print("Strong") else: print("Weak")

1/3/2020 3:26:19 PM

Saja Ali

7 Answers

New Answer

+2

Saja Ali len(x) >= 7 should be len(pw)>=7

+2

Oh Great thank you

0

string.punctuation has many more punctuation characters than what is required by the program

0

It says the pw has to contain at least 2 from ('!', '@', '#', '$', '%', '&', '*')

0

Print the list of punctuation (x) if your program has other punctuation chars than mentioned in the problem statement your program will still report true for punctuations

0

I replaced x by ('!', '@', '#', '$', '%', '&', '*') but still not working

0

Just an idea, maybe try set comprehension instead of list, in p and j. Reason: If the same special character appears twice in the password, maybe it should only be counted once. I am not sure if the test cases cover this, though.