diff --git a/diy3.py b/diy3.py new file mode 100644 index 0000000..a0b98ed --- /dev/null +++ b/diy3.py @@ -0,0 +1,10 @@ +username="python" +userpassword="123456" +while True: + name=input("用户名:") + password=input("密码:") + if username!=name: + print("用户名错误!请重新输入!") + if userpassword!=password: + print("密码错误!请重新输入!") +print("欢迎来到贝尔编程") diff --git a/diy4.py b/diy4.py new file mode 100644 index 0000000..43c6e1b --- /dev/null +++ b/diy4.py @@ -0,0 +1,14 @@ +username="python" +userpassword="123456" +while True: + name=input("用户名:") + password=input("密码:") + if username==name and userpassword==password: + print("登录成功") + break + if username!=name: + print("用户名错误!请重新输入!") + continue + if userpassword!=password: + print("密码错误!请重新输入!") +print("欢迎来到贝尔编程") \ No newline at end of file