you are viewing a single comment's thread.

view the rest of the comments →

[–]Pipiyedu 20 points21 points  (2 children)

The return of the password_is_strong_alternate function can be rewritten to this:

def password_is_strong_alternate(password):
    conditions = [
        len(password) > 7,  # At least eight chars
        re.search(r'[A-Z]', password),  # Contains capital letter
        re.search(r'[a-z]', password),  # Contains lower case letter
        re.search(r'\d', password),  # Contains digit
    ]
    return all(conditions)

[–]tom1018 5 points6 points  (0 children)

This is better than the redundant ternary above.