From af70518671341c83307877f9083c445b788f6d64 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 29 Apr 2023 17:19:49 +0800 Subject: [PATCH] auto save --- diy2.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/diy2.py b/diy2.py index 76ba2bb..c565c8e 100644 --- a/diy2.py +++ b/diy2.py @@ -1,9 +1,18 @@ +i=3 username = "python" userpassword = "123456" while True: - name = input("请输入用户名:") - password = input("请输入密码:") - if name == username and password == userpassword: - print("登录成功!") - print("用户名和密码错误!请重新输入") -print("欢迎来到贝尔编程!") \ No newline at end of file + if i>0: + name = input("请输入用户名:") + password = input("请输入密码:") + i-=1 + if name == username and password == userpassword: + print("登录成功!") + break + if name!=username: + print("账号不存在,请重新输入") + if password!=userpassword: + print("密码错误,请重新输入") + else: + +print("欢迎来到贝尔编程") \ No newline at end of file -- libgit2 0.25.0