7 Answers
New Answer1. You have not checked whether there are both capitalized and non-capitalized characters. 2. For improving efficiency, learn RegEx. https://www.sololearn.com/learn/9704/?ref=app
Thank you Gordon for the answer, for the 1. I made the code with the challenge in learncode where capitalize letters are not a condition =) Thanks for RegEx I will learn it!
The code I just add for password validate, it works on my laptop but I don't know if it's efficient
You are welcome, Wayne. I like to highlight some example codes in our Coding Challenge (a. k. a. Assignment) section. https://www.sololearn.com/learn/7028/?ref=app 1. Michal's - smart but not a good practice, in terms of team collaboration. https://code.sololearn.com/c2G86cu62B1c/?ref=app 2. Anna's - succinct and well structured. https://code.sololearn.com/c2HFPU6uK4JI/?ref=app 3. David Carroll's - Explaining RegEx in detail. https://code.sololearn.com/cgjn2TAuakXA/?ref=app - - - There is another series of RegEx tutorial curated by Danijel Ivanovic. It is demonstrated in Java / JavaScript, but the RegEx is the same. https://code.sololearn.com/Wx88zgigVueq/?ref=app https://code.sololearn.com/W6UCupGsRwzB/?ref=app
You are probably better learning regular expressions for a task like this. Im still a python novice but this is my example using some regex. https://code.sololearn.com/cvgLH0cp2Wks/?ref=app