I have been struggling with a task to check if a password has different attributes without for loop. Such as if it has lower case letters, upper case letters, numbers, symbols and so on. would really appreciate some help on the matter. I am new to recursive functions so I would be more than pleased if someone has an idea for a solution not involving them in python.
My attempt so far:
def strength(password):
if password[1:].isnumeric:
score = 0
if password[1:].isalpha():
score += 3
if password[1:].islower():
score += 2
if password[1:].isupper():
score += 2
if password[1:].isalpha():
score += 3
return score
Sorry that I didn't put this earlier, I'm still a little new to the site. This code only checks whether the entire password is numeric or lowercase or so on to my understanding. How can I extend this to check for other criteria, such as containing symbols?