+ 1

I am trying to solve this challenge named "password validator" using python . Only and only test case #13 fails .

Trying to find the mistake . Please try to help me. Please don't send alternative solutions Instead please find and tell the mistake I have made Code is as below : password = input() nums = '1234567890' symb = '!@#$%&*' count = 0 for i in nums : for j in nums : a = i+j if a in password : count += 1 for k in symb : for l in symb : b = k+l if b in password : count +=1 if (count >= 2 and len(password) >= 7 ) : print('Strong') else: print('Weak') https://code.sololearn.com/c79DCZ9WE9Vw/?ref=app

11th Mar 2022, 9:40 AM
Himanth Gowda
Himanth Gowda - avatar
5 Respostas
+ 3
Did you try something else? password = input() nums = '1234567890' symb = '!@#$%&*' count = 0 for i in nums : if i in password : count += 1 for k in symb : if k in password : count +=1 if (count >= 2 and len(password) >= 7 ) : print('Strong') else: print('Weak')
11th Mar 2022, 10:44 AM
Simba
Simba - avatar
+ 2
Nested loop isn't necessary here. Just do it like this for i in nums : if i in password : count += 1 And the same goes to the next loop.
11th Mar 2022, 9:52 AM
Simba
Simba - avatar
+ 2
Simba Thank you soo much Simba for your time to answer my problem. Now I got to know what mistakes i was making !!!
11th Mar 2022, 11:24 AM
Himanth Gowda
Himanth Gowda - avatar
+ 1
Cool. Nice job. Thanks. 😯😲🤗
12th Mar 2022, 3:49 PM
Asim Farheen ⭐⭐🤺👿👿
Asim  Farheen ⭐⭐🤺👿👿 - avatar
0
Simba I put it in the nested loop because there has to be 2 consecutive numbers and symbols like for eg : 24like@# or more89&$ and it should no be seperated : 2solo6&$ or 2#@1nil More cases will fail if i do not put it in nested loop Even if it is clearly not told in the case I have read many discussions where they have solved and succeeded by using consecutive numbers and symbols
11th Mar 2022, 10:01 AM
Himanth Gowda
Himanth Gowda - avatar