python - The variable does not update for some reason? -
pss = input("enter password") symb = ["!","£","$","%","^","&"] num = ["1","2","3","4","5","6","7","8","9","0"] done = 0#to break symbol check done2 = 0#break num check check = 0#keep track of things correct found = false while found == false: #checks symbol in password ch in pss: done = done + 1 if ch in symb: check = check + 1 break elif done == len(pss):#done , once print("add symbol password") #works!! :d #checks number in password ch in pss: done2 = done2 + 1 if ch in num: check = check + 1 break elif done2==len(pss): print("add number password") #capital letter check if pss == pss.lower(): print("you need have @ least 1 capital letter") else: check = check + 1 #checking if check == 3: print("password validated") found = true else: pss = input("correct password")#re enters password check = 0 #need make pss update correctly
its final few lines having trouble with, program works, password doesn't updated, unnecessary lines printed. example, when entering initial password "jellybean" reminded add number , symbol password. next, when oppouruntiy correct, enter "jellybean5£" , still prompted add number , symbol. program recognizes change , exits, due password being successful .
update done
, done2
variables 0 when you're trying validate
#checking if check == 3: print("password validated") found = true else: pss = input("correct password")#re enters password check = 0 done = 0 done2 = 0
Comments
Post a Comment