0
password validator puzzle
https://www.sololearn.com/coach/76?ref=app Howwww??, it is working fine for all test cases Except test case 10 and 11 which are hidden so i cant even find whats wrong, can anyone help me , its a password validator paw = input() spe = ('!', '@', '#', '
#x27;, '%', '&', '*') a=b=0 for i in range(len(spe)): if spe[i] in paw: a += 1 for i in range(0,10): if str(i) in paw: b += 1 if (a < 2 or len(paw) < 8) or (b < 2): print('Weak') else: print('Strong')5 ответов
+ 2
should output "Strong" but your code output "Weak":
abcd##42
abcd@%55
+ 6
Kairav Bhatia ,
there seems to be an issue when inputting special characters that are not in tuple "spe". if i use this input it shows "Strong", even if it contains: "§/()=".
hello123§$%&/()=?
Strong
this issue results from the way your for loop is working. try to find a way to avoid "not allowed" characters.
happy coding and good success!
+ 2
I figured it out rhe problem was repeating special symbols like @@ or ## and its good now thanks to both of you
+ 2
Lothar there are no "not allowed character to handle" ;)
0
Kairav Bhatia Here's a shorter way of doing this:
a, b, c = input(), 0, 0
for x in a:
if x.isdigit(): b += 1
elif x in "!@#$%&*": c += 1
print(("Weak", "Strong")[len(a) > 6 and b > 1 and c > 1])
# Hope this helps