嘿,我完全是新手,不確定爲什麼我甚至要在cmd.exe中運行我的代碼。 ..我的程序在Python shell中工作,但在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)
你是如何運行它? – Blender 2013-05-08 01:35:18