Editorial for Strong Password


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: wadeyao

from re import search

def is_strong(passwd):
    crit1 = len(passwd) >= 8
    crit2 = search(r'[a-z]', passwd) != None
    crit3 = search(r'[A-Z]', passwd) != None
    crit4 = search(r'[0-9]', passwd) != None
    crit5 = search(r'[-!@#$%^&*()+]', passwd) != None
    crit6 = search(r'(.)\1', passwd) == None
    return crit1 and crit2 and crit3 and crit4 and crit5 and crit6

Comments

There are no comments at the moment.