Strong Password

  • + 0 comments

    Python

    special_characters = "!@#\$%\^&*()\-+"
    patterns = [r'\d', r'[a-z]', r'[A-Z]', rf'[{special_characters}]']
    
    def minimumNumber(n, password):
        res = len([1 for pattern in patterns if not re.search(pattern, password)])
        res += max(0, 6 - (len(password) + res))
        return res