+ 2
What's wrong with my code coach 'password validation' python solution?
Here is the code, it works for all but 2 test cases: import re password = input() if re.search(r"[0-9]{2,}[!@#%&\$\*]{2}[A-Za-z]*", password) and len(password) >= 7: print ("Strong") else: print ("Weak") https://code.sololearn.com/csy74RDDJ4ap/?ref=app
4 Answers
+ 2
If the digit or special are after the letters, it states weak instead of strong.
+ 1
John Wells Thanks alot, please how do you think I can fix this?
0
Stephen Laz-Eke I looped through the password counting the digits and specials. Afterwards, tested length, digits, and specials for their minimum.
0
John Wells Okay. Thanks alot. I appreciate.
Do you know anyway to make regex not to be rigid in positioning?