嘿,我对此完全陌生,不知道为什么我什至试图在 cmd.exe 中运行我的代码......
但是,当我在那里运行我的脚本时,当我输入正确的密码时它无法识别。不过,当我在 python shell 中运行它时,它工作正常。
任何答案或帮助指出我需要学习的正确方向都会很棒。
secret_info=["Whatmough","Graham","NOOB"]
password="1234"
tries=0
locked = 1
def cracker():
attempt=input("Type your Password: ")
return attempt
def checker():
global locked, tries
if cracker() == password:
locked = 0
else:
tries = tries + 1
while 3 > tries and locked==1:
checker()
if locked == 0:
print(secret_info)
if tries == 3:
secret_info=0
print("Self Distructed! Your secret info is now:", secret_info)