Hi i'm getting a little confused with the strength checker i may be completely off here but can someone explain how to get the strength checker to work. Thanks :)
import re
def pword(password):
if len(password) <=10:
print("Your password must be 10 characters long.")
return False
elif not re.findall(r'\d+', password):
print("You need a number in your password.")
return False
elif not re.findall(r'[A-Z]+', password):
print("You need a capital letter in your password.")
return False
elif not re.findall(r'[|\"|\'|~|!|@|#|$|%|^|&|*|(|)|_|=|+|\||,|.|/|?|:|;|[|]|{\}|<|>]', password):
print("You need a symbol in your password.")
return False
else:
print("Password Accepted")
return True
passwordValid = False
while not passwordValid:
password = input("Type in your password: ")
passwordValid = pword(password)
def passStrength():
a = '[A-Z]'
b = '[|\"|\'|~|!|@|#|$|%|^|&|*|(|)|_|=|+|\||,|.|/|?|:|;|[|]|{\}|<|>]'
c = '\d+'
d = '[a-z]'
veryStrongPass = a and b and c and d
strongPass = a and b and c or b and c and d or a and c and d
medPass = a and b or a and c or a and d or b and d or c and d
weakPass = a or b or c or d
if weakPass:
print("Your password is weak!")
elif medPass:
print("Your password is medium!")
elif strongPass:
print("Your password is strong !")
elif veryStrongPass:
print("Your password is very strong !")
passStrength()
