+ 2

[Solved] Everything works perfectly! But why it's showing test case failed! 😞

Please help me... I've built this password validator, everything works great but two hidden test case on there showing "failed". Link: https://www.sololearn.com/coach/76?ref=app Code: psk=str(input()) min_n=0 spcl_c=0 i=0 while(i<10): if(psk.find(str(i))>=0): min_n+=1 i+=1 spcl_c_arr=['!','@','#','

#x27;,'%','&','*'] for n in spcl_c_arr: if(psk.find(n)>=0): spcl_c+=psk.count(n) if(min_n>=2 and len(psk)>=7 and spcl_c>=2): print('Strong') else: print('Weak')

11th Feb 2021, 12:46 PM
Harsh Jaiswal
Harsh Jaiswal - avatar
3 Antworten
+ 6
you are incrementing min_n by 1 everytime you find the number, which isnt the correct solution since there might be the same number multiple times, which will result in false positives what you would want to do is add-assigning the number to psk.count(str(i))
11th Feb 2021, 12:58 PM
Bot
Bot - avatar
+ 4
I got it! 🤗 Thanks...
11th Feb 2021, 1:00 PM
Harsh Jaiswal
Harsh Jaiswal - avatar
+ 3
you are welcome🤗
11th Feb 2021, 1:01 PM
Bot
Bot - avatar