+ 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
5 Answers
+ 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')
+ 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.
+ 2
Simba
Thank you soo much Simba for your time to answer my problem.
Now I got to know what mistakes i was making !!!
+ 1
Cool.
Nice job.
Thanks.
đŻđČđ€
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