Password check program in python not passing one of the test case in Sololearn | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Password check program in python not passing one of the test case in Sololearn

I was practicing a code questions from Sololearn, i was supposed to write a code that let you input the password and it will check the length must be at least 7, must contain at least 2 numbers and 2 special characters. Below is the code I wrote, it passes all teat case but there is one hidden test case which throwing error, if it was not hidden I would have solved it. Can someone help where find the error in this code? passwd = input() check = ['!','@','#','

#x27;,'%','&','*'] x = 0 y = 0 for i in passwd: if i in check and len(passwd) >= 7: x+=1 elif i in str(range(10)) and len(passwd) >= 7: y+=2 if x >= 2 and y >= 2: print('Strong') else: print('Weak')

15th Jul 2021, 3:20 PM
Kaushal Sapelwar
Kaushal Sapelwar - avatar
1 Answer
0
It worked, Thanks
15th Jul 2021, 3:39 PM
Kaushal Sapelwar
Kaushal Sapelwar - avatar