欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

python实例之登录接口

程序员文章站 2022-03-23 09:14:18
作业:编写登陆接口输入用户名密码认证成功后显示欢迎信息输错三次后锁定#__author: huawangxin#date: 2018/8/8_user ="wangsanjin"_passwd = "abc123"counter = 0while counter <3: username = input("Username:") password = input("Password:") if username == _user and passw...

作业:编写登陆接口

  • 输入用户名密码
  • 认证成功后显示欢迎信息
  • 输错三次后锁定
#__author:  huawangxin
#date:  2018/8/8
_user ="wangsanjin"
_passwd = "abc123"
counter = 0
while counter <3:
    username = input("Username:")
    password = input("Password:")
    if username == _user and password == _passwd :
        print("Welcome %s login...." % _user)
        break #跳出,中断
    else:
        print("Invalid username or password !")
    counter += 1
    if counter == 3:
        keep_going_choice = input("还想玩么?[y/n]")
        if keep_going_choice == "y":
            counter = 0

else:
    print("要不要脸,臭流氓啊,小虎。")

 

 

本文地址:https://blog.csdn.net/huawangxin/article/details/107881535

相关标签: python 编程