def attempt_function():
number_of_attempts = 1
saidpassword = ""
if number_of_attempts > 3:
print("You have entered the wrong password too many times, please try again later")
saidpassword = input("the password you entered is incorrect, please try again\n")
if saidpassword != password:
number_of_attempts + 1
saidpassword = input("the password you entered is incorrect, please try again\n")
当我使用所有的尝试时,if number_of_attempts > 3:
似乎不起作用。它基本上不打印
在没有看到更多代码的情况下,不是100%确定,但是在尝试密码后是否调用了“尝试函数”?在顶部设置尝试次数=1,因此它从1->;2然后重置为1
您需要一个while循环来增加尝试次数
相关问题 更多 >
编程相关推荐