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')

24th Sep 2020, 12:07 PM
Jahir Raihan Joy
Jahir Raihan Joy - avatar
6 odpowiedzi
+ 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.
24th Sep 2020, 12:19 PM
Russ
Russ - avatar
+ 1
Russ Thanks u so much brother
24th Sep 2020, 12:23 PM
Jahir Raihan Joy
Jahir Raihan Joy - avatar
+ 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?
24th Sep 2020, 12:37 PM
Russ
Russ - avatar
24th Sep 2020, 12:47 PM
Russ
Russ - avatar
0
Russ fixed this but still having test case 5 error
24th Sep 2020, 12:25 PM
Jahir Raihan Joy
Jahir Raihan Joy - avatar
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')
24th Sep 2020, 12:43 PM
Jahir Raihan Joy
Jahir Raihan Joy - avatar