本文主要是介绍python-登录系统,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
import time
import calendar
nowTime = time.strftime("%Y-%m-%d %H:%M %A")
print("当前时间是:", nowTime)
print("------------------我是呆萌的分割线--------------------")
# 登录注册账号
# 会员5次机会,游客3次机会
vip = 5
count = 3
user_name = ["ahu"]
user_pwd = ["1234"]
flag = 0
while flag == 0:
member = input("登录请按【1】\n注册请按【2】\n游客请按【3】\n")
# 登录
if member == "1":
print("-----------------用户登录界面--------------------")
user = input("请输入账号:")
count -= 1
if user in user_name:
pwd = input("请输入密码:")
if pwd in user_pwd:
print("登录成功,欢迎", user, "使用~")
# 当账号密码都对的情况下 break
vip = 5
print("你将有%s次机会查询课表哦~" % (vip))
flag = 1
else:
if count == 0:
print("你的账号被锁定了,请稍后再试")
break
else:
print("密码错误!!!,你还有%s次机会" % (count))
else:
if count == 0:
print("你的账号被锁定了,请稍后再试")
break
else:
print("账号错误!!!,你还有%s次机会" % (count))
# 注册
if member == "2":
print("-----------------用户注册界面--------------------")
user = input("注册一个用户名:")
pwd = input("输入你的密码:")
user_name.append(user)
user_pwd.append(pwd)
print(user_name, user_pwd)
flag = 0
# 游客
if member == "3":
vip = 3
print("你将有%s次机会查询课表哦~" % (vip))
flag = 1
break
这篇关于python-登录系统的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!