What's wrong with the code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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")

3rd Jan 2020, 3:26 PM
Pattern
Pattern - avatar
4 Answers
+ 2
Oh Great thank you
3rd Jan 2020, 4:53 PM
Pattern
Pattern - avatar
0
It says the pw has to contain at least 2 from ('!', '@', '#', '
#x27;, '%', '&', '*')
3rd Jan 2020, 4:08 PM
Pattern
Pattern - avatar
0
I replaced x by ('!', '@', '#', '
#x27;, '%', '&', '*') but still not working
3rd Jan 2020, 4:21 PM
Pattern
Pattern - avatar
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.
3rd Jan 2020, 4:26 PM
Tibor Santa
Tibor Santa - avatar