|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
def showprint():
promit='''
|---新建用户:N/n---|
|---登录账号:E/e---|
|---退出程序:Q/q---|
请输入指令代码: '''
while True:
chosen = False
while not chosen:
choice = input(promit)
if choice not in 'NnEeQq':
print('你输入的指令有误')
else:
chosen = True
if choice == 'q' or choice == 'Q':
break
if choice == 'E' or choice == 'e':
user_login()
if choice == 'N' or choice == 'n':
new_user()
showprint()
问题有2个
1: while True 哪里为什么要用2个while呢
2: 下面if break 无法退出程序
1: while True 哪里为什么要用2个while呢 ---没有必要用两重循环
2: 下面if break 无法退出程序---break只能退出一重循环,如果想退出两重可以用return
|
|