What is wrong with this code (Password validation from code coach) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is wrong with this code (Password validation from code coach)

import re user=input("") length=7 pattern = r"[A-Z][A-Z][0-9]['!','@','#','

#x27;,'%','&','*']" #spl_char=['!','@','#','
#x27;,'%','&','*'] check=re.search(pattern,user) def Password_validate(user): if check and length>=7: return "Strong" else: return "Week" print(Password_validate(user))

2nd Dec 2021, 5:14 AM
Somil Khandelwal
4 Answers
+ 2
Even if you do not know all the nuances of creating a template, you can still write code, just use several instead of one template. ☺️
2nd Dec 2021, 7:15 AM
Solo
Solo - avatar
+ 1
You wrote pattern so that the first two characters must always be in uppercase, 3rd digit, 4th one of the specified characters.
2nd Dec 2021, 6:28 AM
Solo
Solo - avatar
+ 1
You do not understand, you have a fixed pattern with an unchanging sequence of characters.
2nd Dec 2021, 7:11 AM
Solo
Solo - avatar
0
I fixed it and still this code is not working from[A-Z][A-Z] to [A-Z][a-z]
2nd Dec 2021, 6:37 AM
Somil Khandelwal