I have tried to make a 'password checker' program that checks if an entered variable contains specific characters. I will need it to check thee things: uppercase, lowercase and number. There are 3 things that the program will hopefully output, and these are:
Weak
, for passwords with only upper OR only lower OR only numberMedium
, for passwords that have upper and lower, OR upper and number, OR lower and numberStrong
, for passwords that contain upper, lower and number at the same time.
This is my code:
if EnteredPassword.isupper() or EnteredPassword.islower() or EnteredPassword.isdigit():
print ("Your password is weak")
elif EnteredPassword.isupper()and EnteredPassword.islower():
print ("Your password is medium")
elif EnteredPassword.isupper() and EnteredPassword.isdigit():
print ("Your password is medium")
elif EnteredPassword.islower() and EnteredPassword.isdigit():
print ("Your password is medium")
elif EnteredPassword.isupper() and EnteredPassword.islower() and EnteredPassword.isdigit():
print ("Your password is strong")
else:
print ("That password should not have been accepted")
quit()
However, when the program is run, and for example I have put in UPPERLOWER6
the program skips to the else statement. If I put something that just contains UPPER
etc., that is the only one that works and comes up with your password is weak
If there is anything wrong with the code I cannot see, please point it out. I have been re-directed to other questions but they are too complicated for me and people would know I have copied is, which is not allowed.
Many thanks!