+1

I can’t figure out what test case 7 is. This code passes all but 7. I know it might seem like a lot but it makes sense in my booby code brain. a=input() b=list(a) c=len(b) d=list(filter(lambda x: x.isalpha(),b )) f=len(d) e=list(filter(lambda y: y.isdigit(),b)) g=len(e) s=[] m=["%", "#","*","!","\$","&","@"] for i in b: for j in m: if i==j: s.append(i) v=len(s) if c>=7: if f>=2: if v>=2: print("Strong") else: print("Weak") else: print("weak") else: print("Weak")

10/17/2021 7:51:41 AM

Fernando Zamora

+4

Fernando Zamora , you should make changes in the loop -> no need of two loops, also in your checks "f" is the number of letters of the alphabet in the password, you should check for digits "g". Look at the code: a=input() b=list(a) c=len(b) d=list(filter(lambda x: x.isalpha(),b )) f=len(d) e=list(filter(lambda y: y.isdigit(),b)) g=len(e) s=[] m=["%", "#","*","!","\$","&","@"] for i in b: if i in m: s.append(i) v=len(s) if c>=7: if g>=2: if v>=2: print("Strong") else: print("Weak") else: print("Weak") else: print("Weak")

+3

Fernando Zamora , in one of the else clauses you wrote "weak" instead of "Weak".

0

Thanks! I fixed that, but it wasnt the issue. Case 7 still fail.

0

That f to g change was the fix! Thank you!

0

password = list(input()) str = " ".join(password) #a string with space b/w the items import re symb = re.findall("[[email protected]#\\$%&\*]+", str) num = re.findall(r"[0-9]+", str) filt = filter((lambda x: x in symb,str), (password)) print ("Strong" if len(symb) >= 2 and len(num) >= 2 and len(password) >=7 else "Weak")