[SOLVED] (Code Coach)Password Validation is not working
I have written the solution satisfying all the conditions but still it is failing 7/13 test cases.
Can somebody please explain what is wrong in my solution
Question : https://www.sololearn.com/coach/76?ref=app
Better to make your own question always..
Also your question is python.. So
Try these first then make question or use search bar for python answer...
First if it length is less than 7, need to print Weak, and stop further execution so exit there otherwise it prints 2 times Weak.
Next remove 10 and 15 lines.
It executing length of input times instead of only 1 time..
By these changes, your code works fine.
#please check what I'm doing wrong
p.strip() #remove spaces
spchar=['!', '@', '#', '$', '%', '&', '*']
for i in range(len(p)):
for j in range(len(spchar)):
x=p.count(spchar[j]) #count all chars-p
str(a.append(x)) #store non-0 result
for o in range(len(p)):
for k in range(len(nums)): #count all num-p
str(b.append(y)) #store non-0 result
c,n=sum(a),sum(b) #sum of all chars/nums found
if (c>=2 and n>=2):