• + 0 comments
    def minimumNumber(n, password):
        # Return the minimum number of characters to make the password strong
        minLength = 6
        patterns = [r'[0-9]', r'[a-z]', r'[A-Z]', r'[!@#$%^&\*\(\)\-\+]']
        total_chars = sum([1 for pattern in patterns if not re.search(pattern, password)])
        total_chars += (0 if minLength <= n + total_chars else minLength - n - total_chars)
        return total_chars