import re
score = 0
capital_letters = r'[A-Z]'
a = re.compile(capital_letters)
lowercase_letters = r'[a-z]'
b = re.compile(lowercase_letters)
def increase_score (aValue, aScore):
aScore += aValue
return aScore
def upper_score(test_string, aScore):
if re.match(a, test_string):
aScore = increase_score(5, aScore)
print (aScore)
print("UPPERCASE")
else:
print("The password needs capital letters for a higher score")
def lower_score(test_string, aScore):
if re.match(b, test_string):
aScore = increase_score(5, aScore)
print (aScore)
print("LOWERCASE")
else:
print("The password needs lowercase letters for a higher score")
password = input("Enter a password to check")
upper_score(password, score)
lower_score(password, score)
If I input all upper case letters I get this output:
5
UPPERCASE
The password needs lowercase letters for a higher score If I input all lower case letters I get this output:
The password needs capital letters for a higher score
5
LOWERCASE
When i mix upper case annd lowercase i get this output:
5
UPPERCASE
5
LOWERCASE
Even though there are both uppercase and lowercase letters the score is still 5 instead of 10.
I want the score to be cumulative and build ontop of each other.