+ 1

Why does the test case 4 is wrong?

n = input() a = 0 b = 0 for i in n: if i in "1,2,3,4,5,6,7,8,9": a = a+1 if i in "'!', '@', '#', '

#x27;, '%', '&', '*'": b = b+1 if b >= 2 and a >= 2: print("Strong") else: print("Weak")

30th Jun 2021, 10:36 AM
Shahir
Shahir - avatar
4 Réponses
+ 4
Remove the extra characters from your strings or change them completely to a list or tuple. "1234567890" "!@#$%&*" The commas and single quotes are being counted as well.
30th Jun 2021, 10:44 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
There will be additional needed at least 7 characters.
30th Jun 2021, 10:45 AM
JaScript
JaScript - avatar
+ 2
You forgot one thing: The length of the password must be greater (or equal) than 7 => n = input() a = 0 b = 0 for i in n: if i in "1,2,3,4,5,6,7,8,9": a = a+1 if i in "'!', '@', '#', '
#x27;, '%', '&', '*'": b = b+1 if b >= 2 and a >= 2 and len(n) >= 7: print("Strong") else: print("Weak")
30th Jun 2021, 10:45 AM
Baspberry
+ 2
Thanks
30th Jun 2021, 10:47 AM
Shahir
Shahir - avatar