变量由于某种原因没有更新?

时间:2017-08-20 20:43:49

标签: python passwords

pss = input("Enter a 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 for a symbol in the password
    for ch in pss:
        done = done + 1
        if ch in symb:
            check = check + 1
            break
        elif done == len(pss):#done , only to say once
            print("Add a symbol to your password")

    #WORKS!! :D



    #checks for number in password

    for ch in pss:
        done2 = done2 + 1
        if ch in num:
            check = check + 1
            break
        elif done2==len(pss):
            print("Add a number to your password")



    #capital letter check

    if pss == pss.lower():
        print("You need to have at least one capital letter")
    else:
        check = check + 1







    #checking
    if check == 3:
        print("Password Validated")
        found = True
    else:
        pss = input("Correct you password")#re enters password
        check = 0

    #need to make pss update correctly

我遇到问题的最后几行,程序正常工作,只是密码没有更新,所以打印了不必要的行。例如,当输入初始密码“Jellybean”时,我会收到提醒,要在密码中添加一个数字和一个符号。接下来,当我得到正确的解决方法时,我输入“Jellybean5£”,我仍然会被提示添加一个数字和一个符号。但是,由于密码成功,程序会识别更改并退出。

1 个答案:

答案 0 :(得分:1)

当您尝试验证时,将$queryString = "MATCH (a:signup{iid:'$id'})-[r]->(b:signup{iid:'$s_id'}) return type(r) "; $query = new Everyman\Neo4j\Cypher\Query($client, $queryString); $result = $query->getResultSet(); if($result == 'Knows') { $s_relation = $result; } else { $s_relation = 'empty'; } done变量更新回0

done2