I am trying to make a code to validate a password. However it is not working, any ideas on how to fix this?
password = input("Please enter password: ")
length = False
digit = False
capital = False
length = len(password)
if length > 6:
length = True
#print("Length Good")
for count in password:
if count.isdigit():
digit = True
#print ("Contains digit")
for count in password:
if count.isupper():
capital = True
#print ("Contains a capital")
if length != True and digit != True and capital != True:
print("Password is good")
else:
print("Bad password")
any ideas on how to fix this, thanks
lengthcannot be the length of your password and also a true/false value. Use two variables.