def attempt_function() 。
number_of_attempts =1
saidpassword = "": saidpassword = "".
if number_of_attempts > 3:
print("您輸入錯誤密碼的次數過多,請稍后再試")
saidpassword = input("你輸入的密碼不正確,請再試一次
")
if saidpassword != password:
number_of_attempts 1
saidpassword = input("您輸入的密碼不正確,請再試一次
")
if number_of_attempts > 3:當我使用所有的嘗試時,似乎不作業。它基本上不列印。
uj5u.com熱心網友回復:
def attempt_function():
number_of_attempts =0
saidpassword = "": 試試吧
while saidpassword != password:
number_of_attempts 1
saidpassword = input("您輸入的密碼不正確,請再試一次
")
if number_of_attempts > 3:
print("您輸入了太多次錯誤的密碼,請稍后再試")
break
saidpassword = input("您輸入的密碼不正確,請再試一次
")
你將需要一個while回圈來增加嘗試的次數
uj5u.com熱心網友回復:
沒有看到更多的代碼,不能100%確定,但是 "attempt_function "是否在一次密碼嘗試后被呼叫?在頂部設定number_of_attempts = 1,所以它從1->2然后重置為1?
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/314525.html
標籤:
上一篇:確定Excel表格中的頁數
