当前位置: 移动技术网 > IT编程>脚本编程>Python > python二级登陆菜单

python二级登陆菜单

2019年06月22日  | 移动技术网IT编程  | 我要评论

二战纪录片天启下载,液位计,婴儿奶粉排行

"""
1.三级菜单 注册 登陆 注销
2.进入每一个一级菜单,都会有下一级的菜单

"""
user_item = dict()
try:
while true:
print('-------welcome sir-------')
input_choice = int(input('please enter your choice:1:registration 2:login 3:logout:'))
# 用户输入自己的选择,会进入到相关的二级菜单
if input_choice == 1:
# if input_choice==1 进入注册
user = input('please enter your account number:')
pwd = input('please enter your password:')

# 保存用户注册的账号
user_item['user'] = user
user_item['pwd'] = pwd
# 提示用户注册成功
print('您的账号已生效,下次请用该账号:{}登陆本系统'.format(user))

# if input_choice==2 进入登陆
elif input_choice == 2:
login_user = input('please enter your login account number:')
login_pwd = input('please enter your login password:')

# 对用户输入的账号和密码进行确认
if login_user == user_item['user'] and login_pwd == user_item['pwd']:
print('welcome sir:{}'.format(login_user))
else:
print('sorry, your account or password is incorrect. please confirm and come back')
# if input_choice == 3 进入注销
elif input_choice == 3:
logout_input = input('do you really want to quit this system?,y or n')
if logout_input == 'y':
break
elif logout_input == 'n':
input_choice = int(input('please enter your choice:1:registration 2:login 3:logout:'))
else:
print('your input is incorrect')
except exception as re:
print(re)
finally:
print('')

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网