0
Password validation. #Test_case#5
Why this test case 5 is showing wrong. Can anybody please help me to fix this test case error. My code: p= input() num,special = '1234567890','!@#৳$%&*' s,k=0,0 for i in p : if i in num: k +=1 if i in special: s+=1 if len(p)<=14 and len(p)>=7: if s and k >=2: print('Strong') else: print('Weak') else: print('Weak')
6 Réponses
+ 1
if s >= 2 and k >= 2:
if s and k >= 2 will return True if s == 1 and k >= 2 which is not what you want.
+ 1
Russ Thanks u so much brother
+ 1
I don't see any requirement in the description that the password must be no more than 14 characters long. Maybe that's where your issue is?
+ 1
0
Russ fixed this but still having test case 5 error
0
Russ I Don't know how to thank u bro.
My code worked and passed.
Thanks for your cooperation.
Thank u Thank u Thank u😘
Final code:
p= input()
num,special = '1234567890','!@#৳$%&*'
s,k=0,0
for i in p :
if i in num:
k +=1
if i in special:
s+=1
if len(p)>=7:
if s and k >=2:
print('Strong')
else:
print('Weak')
else:
print('Weak')