From 18a645647b1f50c739a8554bf714c7512741d43d Mon Sep 17 00:00:00 2001 From: pjpn35fey <1379522201@qq.com> Date: Tue, 2 Jul 2024 20:54:47 +0800 Subject: [PATCH] =?UTF-8?q?Delete=20'python=E6=93=8D=E4=BD=9C=E9=A2=98?= =?UTF-8?q?=E7=AD=94=E6=A1=88.txt'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python操作题答案.txt | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 python操作题答案.txt diff --git a/python操作题答案.txt b/python操作题答案.txt deleted file mode 100644 index e65c7a4..0000000 --- a/python操作题答案.txt +++ /dev/null @@ -1,30 +0,0 @@ -import time -# 假设的用户数据 -USER_DATA = { - 'username': 'admin', - 'password': '1234' -} -# 尝试次数限制 -MAX_ATTEMPTS = 3 - -def login(): - attempts = 0 - while attempts < MAX_ATTEMPTS: - # 从命令行获取用户名和密码 - username = input("请输入用户名:") - password = input("请输入密码:") - - # 验证用户名和密码 - if USER_DATA['username'] == username and USER_DATA['password'] == password: - print("登录成功") - return True - else: - print("登录失败,用户名或密码错误") - attempts += 1 - print(f"您还有 {MAX_ATTEMPTS - attempts} 次尝试机会。") - - print("登录失败次数过多,账户被锁定。") - return False - -if __name__ == "__main__": - login() \ No newline at end of file