+ 2

Problem: Password Validation

This code works from test 1~9, but not at the rest. Would someone tell me why? β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” s= input() import re alp=len(re.sub('[^A-Za-z]+','',s)) num=len(re.sub('[^0-9]+','',s)) spe=len(re.sub('[^[email protected]#$%&*]+','',s)) if num>1 and spe>1 and alp>6: print("Strong", end=" ") else: print("Weak", end=" ") β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

27th Apr 2020, 6:43 AM
Yes
Yes - avatar
7 Answers
+ 1
Nephilim there was one more error. Look I have updated the answer..
27th Apr 2020, 7:00 AM
Arsenic
Arsenic - avatar
1st May 2020, 5:53 AM
Yaswanth
Yaswanth - avatar
+ 1
Question statement says special characters include ('!', '@', '#', '
#x27;, '%', '&', '*') You missed "!" Symbol while evaluating special characters. and also you are checking only the length of letters in the string whereas according to question total length should be at least 7. here is the fixπŸ‘‡ https://code.sololearn.com/ct5JPTBUfubq/?ref=app
27th Apr 2020, 6:51 AM
Arsenic
Arsenic - avatar
+ 1
Thanks for the answer. After that I fixed ? to ! but it still doesn’t work at 10~13 ...
27th Apr 2020, 6:58 AM
Yes
Yes - avatar
+ 1
oh that’s right! thanks!
27th Apr 2020, 8:45 AM
Yes
Yes - avatar
+ 1
yes, that works too!
2nd May 2020, 12:45 AM
Yes
Yes - avatar
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")
5th Dec 2021, 8:15 PM
Mas'ud Saleh
Mas'ud Saleh - avatar