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
4 odpowiedzi
+ 2
This is another way to write the code.
https://code.sololearn.com/c6rCU16ikZ2U/#py
# Keep learning & happy coding :D
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
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
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)