Strong Password

  • + 0 comments

    Here is my Python solution!

    def minimumNumber(n, password):
        specials = ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "+"]
        upper = False
        lower = False
        special = False
        num = False
        for letter in password:
            if letter.isupper():
                upper = True
            elif letter.islower():
                lower = True
            elif letter.isnumeric():
                num = True
            elif letter in specials:
                special = True
        return max(0, 6 - n, [upper, lower, special, num].count(False))