python 基础登陆接口

1、编写登陆接口
  • 输入用户名、密码
  • 认证成功后显示欢迎信息
  • 输错三次后锁定
#!/usr/bin/env python
#_*_coding:utf-8_*_

UserName = "LHR"
PassWord = "123456"
count = 0
while count<3:
    username = input("Please input the username:")
    while count <3:
        if username == UserName:
            password = input("Input the password:")
            if password == PassWord:
                print("Welcome!")
                break
            else:
                print("Invalid password!")
                count+=1
                if count >3:
                    break
        else:
            print("Invalid account!")
            count +=1
else:
    print("Sorry,Invalid username or password!")

 

 

posted @ 2021-11-09 00:03  刘六六LHR  阅读(94)  评论(0)    收藏  举报