python二级_python二级登陆菜单

"""

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('')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值