0

Password Validation not working

Any ideas? I am failing 2/13 cases..:-/ inp = str(input()) input = inp.replace(" ", "") list = [] for i in input: list.append(str(i)) check = [] for i in range(10): check.append(str(i)) num = [] for i in range(len(check)): if check[i]in list: num.append(i) char = ['!', '@', '#', '

#x27;, '%', '&', '*'] testchar = [] for i in range(len(char)): if char[i] in list: testchar.append(char[i]) if ((len(input) >=7) & (len(testchar) >= 2) & (len(num)>=2)): print('Strong') else: print('Weak')

24th Feb 2020, 7:43 PM
Steve
4 Antworten
+ 7
Gabriel Ilie The idea behind this is not sharing your own solution so the others can copy and get free XP. Steve has a code and we are supposed to tell him what's wrong and how to improve it. We are here to LEARN.
24th Feb 2020, 8:25 PM
Kevin ★
+ 3
Kevin Star I totally agree with what you've said, however I've seen more than one mod post answers to code coach challenges here so I've started to think that's what we're supposed to do. @Steve I think your code doesn't account for the fact that the same number or character may appear twice in the string.
24th Feb 2020, 8:53 PM
Russ
Russ - avatar
+ 1
i solved the problem! i switched the lists around and it worked! thanks 4 your replies!
25th Feb 2020, 1:14 PM
Steve
24th Feb 2020, 8:16 PM
Gabriel Ilie
Gabriel Ilie - avatar