I need to make a simple password checker, it needs to check if the string has at least one lowercase letter, one uppercase letter and one number.
here's what i have
passwd = raw_input("enter your password: ")
upper = 0
lower = 0
number = 0
while len(passwd) < 7 and upper <= 0 and lower <= 0 and number <= 0:
print 'start'
for x in passwd:
if x.isupper()==True:
print 'upper'
upper+=1
elif x.islower()==True:
print 'lower'
lower+=1
elif x.isalpha()==False:
print 'num'
number+=1
print ('password not complex enough')
upper = 0
lower = 0
number = 0
passwd = raw_input('please enter password again ')
those random looking prints are for debugging so i can see where it's reaching.
and what looks like is happening is that it only checks the first condition, the length condition and then leaves the loop.
here's a sample of what is happening
enter your password: pA1
start
lower
upper
num
password not complex enough
please enter password again password
why is it only checking the length condition? what did i do wrong?