You have some problems with your checking logic. First of all you re-set your control variables before the while condition could check them. Furthermore you used and to test if all conditions are true, while or is what you should be using. If you want to keep the basic structure of your code, the best way to go is to use only True in your while statement and then break the loop once all conditions are fulfilled. Of course, as shown in the other answers, there are much more compact ways to check that all conditions are fulfilled.
passwd = raw_input("enter your password: ")
upper = 0
lower = 0
number = 0
while True:
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
if len(passwd) < 7 or upper <= 0 or lower <= 0 or number <= 0:
print ('password not complex enough')
passwd = raw_input('please enter password again ')
upper = 0
lower = 0
number = 0
else:
break
print 'final password:', passwd
Output:
enter your password: pA
lower
upper
password not complex enough
please enter password again pA1ghlfx78
lower
upper
num
lower
lower
lower
lower
lower
num
num
final password: pA1ghlfx78