python实现登陆功能

要求:

1、用户输入用户名和密码;

2、最多登陆三次;

代码实现:

#Author:Kelly
#登陆3次
username = "kkk"
password = "123"
count = 0
while count < 3:
    name = input("username:")
    pwd = input("password:")
    if name == username and pwd == password:
        print("welcome " + name + "!!!")
        break
    else:
        print("username or password is wrong,please input again!")
    count+=1
    if count >= 3:
        print("您输入的太频繁了,请稍后再试!")

猜你喜欢

转载自blog.csdn.net/panyueke/article/details/87816799