0
Codecoach password validation python 3
Hello, I have a problem with the last of 13 code checks of the password validator. I've already tried one change (see comments in the code) to have 2 and only two symbols. But with the changes I failed 3 checks instead of 1. I would appreciate your help! Thanks https://code.sololearn.com/cKXTtGibU69P/?ref=app
19 Answers
+ 4
Hmm cool that it worked but i get where youre coming from. Heres what works in pyscripter for me:
symRegex = re.compile(([!@#$%^&*]{2})+)
'!' doesnt pass
'!%' passes
+ 4
password validation sololearn solution Python
https://code.sololearn.com/cvm7w6k0oYUt/?ref=app
+ 2
Try creating a seperate regex for each check. It become more simple when you,
for example,
make a numberRegex to check if theres at least one number, make a password length regex to make sure its long enough, ect.
Then just create a "check" function that has ALL regex checks inside and have the input pass as the parameter
+ 2
Thanks for the help, with your first comment, I did not understand what you mean, but now I think I get it and try to adapt the codeđ
+ 2
Slick thanks for your help. Changed it and I completed the challenge. But I'm not sure if the description of the problem fits the solution. My new code, as I understand it, only demands 1 symbol and one number instead of 2..
https://code.sololearn.com/cKXTtGibU69P/?ref=app
+ 1
And it looks like you set up your regex with a raw string. THATS GREAT!
But to make a regex:
randRegex = re.compile([a-zA-Z]+)
See how "re.compile()" was used?
This regex matches one or more letter of any case
+ 1
Wait...need to do more tests
+ 1
Got it.
symbolRegex = re.compile(r'''(
([!@#$%^&*])+
([^!@#$%^&*])*
([!@#$%^&*])+
)''',re.VERBOSE)
It just says there will be one or more symbols, then zero or more NONsymbols, then one or more symbols after that
+ 1
VERBOSE is used just to structure it as so. It disregards newlines and comments in the regex
0
Awesome, just shoot me a message if anything. Good luck