r/ProgrammingPrompts • u/normandantzig • Dec 06 '16
Strong Password Detection
Write a function that uses regular expressions to make sure the password string it is passed is strong. A strong password is defined as one that is at least eight characters long, contains both uppercase and lowercase characters, and has at least one digit. You may need to test the string against multiple regex patterns to validate its strength.
Source: AutomateTheBoringStuff
10
Upvotes
View all comments
Show parent comment
1
u/normandantzig Dec 09 '16 edited Dec 09 '16
It works fine when the pattern matches but when it does not match it throws up an error.
EXAMPLE: Type a password fdfs <class 'NoneType'> None Traceback (most recent call last): File "Z:\strongPasswordChecker.py", line 36, in <module> if passString == mo.group(): AttributeError: 'NoneType' object has no attribute 'group'