发布于2019-08-08 11:13 阅读(557) 评论(0) 点赞(0) 收藏(1)
"""
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('')
作者:ryuer8423
链接:https://www.pythonheidong.com/blog/article/13556/065916bce4290c6af4f6/
来源:python黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 python黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-1
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!