Python-day1 登陆作业

# 1、写一个登录的程序,
# 1、最多登陆失败3次
# 2、登录成功,提示欢迎xx登录,今天的日期是xxx,程序结束
# 3、要检验输入是否为空, 账号和密码不能为空
# 4、账号不区分大小写

import time
usesnames = ['bairuifeng']
passwords = ['123456']
time = time.strftime('%Y-%m-%d %X')

for i in range(3):
    usesname = input('请输入账号:').strip().lower()
    password = input('请输入密码:').strip()
    if len(usesname)==0 and len(password)==0:
        print('账号密码不能为空!')
    elif usesname== usesnames[0] and password==passwords[0]:
        print('登录成功,提示欢迎%s登录,今天的日期是%s'%(usesname,time))
        break
else:
    print('错误次数已经用尽!')

猜你喜欢

转载自www.cnblogs.com/brf-test/p/12227179.html