+ 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('[^?@#$%&*]+','',s)) if num>1 and spe>1 and alp>6: print("Strong", end=" ") else: print("Weak", end=" ") ââââââââââââââââââââââââââ
7 Respostas
+ 1
Nephilim there was one more error. Look I have updated the answer..
+ 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
+ 1
Thanks for the answer.
After that I fixed ? to ! but it still doesnât
work at 10~13 ...
+ 1
oh thatâs right! thanks!
+ 1
yes, that works too!
0
password = list(input())
str = " ".join(password) #a string with space b/w the items
import re
symb = re.findall("[!@#\$%&\*]+", 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")