0
Password validation
password = input() count = 0 count1 = 0 chars = ['!', '@', '#', '
#x27;, '%', '&', '*'] for ch in password: if ch.isdigit: count+=1 if ch in chars: count1+=1 chars.remove(ch) if ((count >= 2) and (count1>=2)) and (len(password) >= 7): print("Strong") else: print("Weak") So I can not pass test 10 and 11, but if I remove line chars.remove(ch) I can’t pass only test number 7. Can someone help? :)3 Antworten
+ 1
Count is not counting the digits, it's counting the characters in the password
Put ()
If ch.isdigit():
+ 2
In the paasword validator there are a case of LeTme!n so there is only one occurence of chars.So you have to reset your condition of chars count1 .
0
Indentation is not the problem, bc i copied it and indentation felt apart. But I still dont understand why without remove specific test is’nt working. But with removing it works perfectly - makes no sense