0

Why am i faling test 10 and 11(password validator)?

I was failing test 8 and solved it but now 10 and 11 are failing https://code.sololearn.com/cGEdgwo6km9U/?ref=app

18th Nov 2021, 3:08 PM
Yiğit Can Yöntem
Yiğit Can Yöntem - avatar
4 odpowiedzi
+ 2
This is another way to write the code. https://code.sololearn.com/c6rCU16ikZ2U/#py # Keep learning & happy coding :D
18th Nov 2021, 6:07 PM
SoloProg
SoloProg - avatar
0
Yiğit Can Yöntem If there is one special character two times, it is valid too. So there is no need for new_list in your program. Remove new_list and everything you did with it. Change the for loop too for v in range(l): if x[v] in marks: count_1 += 1
18th Nov 2021, 3:42 PM
Arun Ruban SJ
Arun Ruban SJ - avatar
0
Arun Ruban SJ In the task it says 2 of and i tried it without new_list and if i do that it passes tests 10 and 11 but fails 8
18th Nov 2021, 3:43 PM
Yiğit Can Yöntem
Yiğit Can Yöntem - avatar
0
Yiğit Can Yöntem I tried without new_list and all test cases are working # Password Validator password = input() def validation(x): marks = ["!", "@", "#", "
quot;, "%", "&", "*"] l = len(x) if l >= 7: count = 0 count_1 = 0 for i in range(l): if x[i].isdigit(): count += 1 if count >= 2: for v in range(l): if x[v] in marks: count_1 += 1 else: print("Weak") return if count_1 >= 2: print("Strong") else: print("Weak") else: print("Weak") validation(password)
18th Nov 2021, 4:02 PM
Arun Ruban SJ
Arun Ruban SJ - avatar