0
I am trying to solve Password Validation but it's not working. What is the wrong
19 odpowiedzi
+ 2
SUJIT
No problem,here you go
https://code.sololearn.com/c3pa6hB6L1AQ/?ref=app
Let me know if you have any questions for the code
+ 3
You forgot to add an else statement for the last if statement that checks the length of the password,the strong and weak only gets printed out if the length is >= 7,so an additional else statement is needed for this
+ 3
Delicate Cat I didn't get you. Can you please explain this?
+ 2
Okay
+ 1
SUJIT can you tell me what is not working? Is it not printing anything? and a sample input would be useful
+ 1
SUJIT
I finally figured it out,i tried random test cases and one test case caught my eye,if you repeat the same special char and the same number in the password,the check only registers 1 count of the special char and 1 count of the number,therefore it returns "weak"
What you need to do is convert the password into list, check each number and special in the password list,if found then get the real count of the special character and number using the count function of list,and then use that as the benchmark to check if its >= 2
Let me know if u need the code
+ 1
SUJIT
It basically assigns value to the list on each index ,making each value 1 string and not just the whole value ,you can do it either way with [0:] , [:0] or [0:0] or [0:-1] all works
something like a list comprehension also works but thats simpler to write
0
raynard Your Answer is correct but still didn't working.
0
raynard I am trying solve this Password Validation problem in Sololearn. All test cases are passed except two.
0
SUJIT
def numberCheker(s):
m = 0
for i in s:
if i.isdigit():
m += 1
if m >= 2:
return True
else:
return False
A number checker function like this should work better since it only checks for digit,but to my surprise it still fails on the two test cases,i might need to come back later
0
raynard Thanks. Let me try first ,If I fail I will take your help.
0
SUJIT
no problem💪
0
raynard I am unable to solve the problem though I understood your logic. Can you please give me the code?
0
Thank You raynard
0
"passwo[:0]=passw" raynard why you write this line?
0
How come on my code page I added the circle codes but they didn't work out
0
А
В
С
0
Вы пидоры омерикански