鱼C论坛

 找回密码
 立即注册
查看: 2091|回复: 2

[已解决]???

[复制链接]
发表于 2020-9-17 18:01:59 | 显示全部楼层 |阅读模式
5鱼币
  1. userdata={}
  2. def newuser():
  3.     name=input('what is your name:')
  4.     if name in userdata:
  5.         name=input('this name has been used,please fill a new:')
  6.         continue
  7.     else:
  8.         break
  9.     key=input('please set a password:')
  10.     print('successful,go for a try')
  11.     userdata[name]=key



  12. def olduser():
  13.     name=input('what is your name:')
  14.     if name not in userdata:
  15.         name=input('this name do not find,please fill again:')
  16.         continue
  17.     else:
  18.         break
  19.     key=input('please fill password:')
  20.     if key != userdata.pop(name):
  21.         key=input('password is wrong,please fill again:')
  22.         continue
  23.     else:
  24.         print('welcome to system')



  25. while choosen:
  26.     reminder='''set new userdata(n/N)
  27.     olduser go(e/E)
  28.     out of system(q/Q)
  29.     please fill choice:'''
  30.     choice=input(reminder)
  31.     if choice not in ('q','Q','e','E','n','N'):
  32.         choice=('fill wrong,plaese try again:')
  33.         continue
  34.     elif choice=='e' or choice=='E':
  35.         def olduser()
  36.     elif choice=='n' or choice=='N':
  37.         def newuser()
  38.     else:
  39.         print('have out system')
  40.         choosen=0
  41.         
  42.         
  43.    


  44.    
  45.    
  46.    
  47.    
  48.         
复制代码

#为什么会报错?
最佳答案
2020-9-17 18:02:00
你这个里面有很多问题。。。。。。。对着看一下吧

  1. userdata = {'111': '111'}


  2. def newuser():
  3.     name = input('what is your name:')
  4.     while True:
  5.         if name not in userdata.keys():
  6.             key = input('please set a password:')
  7.             print('successful,go for a try')
  8.             userdata[name] = key
  9.             return True
  10.         else:
  11.             name = input('this name has been used,please fill a new:')
  12.             continue


  13. def olduser():
  14.     name = input('what is your name:')
  15.     while True:
  16.         if name not in userdata:
  17.             name = input('this name do not find,please fill again:')
  18.             continue
  19.         else:
  20.             key = input('please fill password:')
  21.             while True:
  22.                 if key != userdata[name]:
  23.                     key = input('password is wrong,please fill again:')
  24.                 else:
  25.                     print('welcome to system')
  26.                     return True


  27. flag = True
  28. while flag:
  29.     reminder = '''set new userdata(n/N)
  30.     olduser go(e/E)
  31.     out of system(q/Q)
  32.     please fill choice:'''
  33.     choice = input(reminder)
  34.     if choice not in ('q', 'Q', 'e', 'E', 'n', 'N'):
  35.         choice = ('fill wrong,plaese try again:')
  36.         continue
  37.     elif choice == 'e' or choice == 'E':
  38.         flag = olduser()
  39.     elif choice == 'n' or choice == 'N':
  40.         flag = newuser()
  41.     else:
  42.         print('have out system')
  43.         flag = False
复制代码

最佳答案

查看完整内容

你这个里面有很多问题。。。。。。。对着看一下吧
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-9-17 18:02:00 | 显示全部楼层    本楼为最佳答案   
你这个里面有很多问题。。。。。。。对着看一下吧

  1. userdata = {'111': '111'}


  2. def newuser():
  3.     name = input('what is your name:')
  4.     while True:
  5.         if name not in userdata.keys():
  6.             key = input('please set a password:')
  7.             print('successful,go for a try')
  8.             userdata[name] = key
  9.             return True
  10.         else:
  11.             name = input('this name has been used,please fill a new:')
  12.             continue


  13. def olduser():
  14.     name = input('what is your name:')
  15.     while True:
  16.         if name not in userdata:
  17.             name = input('this name do not find,please fill again:')
  18.             continue
  19.         else:
  20.             key = input('please fill password:')
  21.             while True:
  22.                 if key != userdata[name]:
  23.                     key = input('password is wrong,please fill again:')
  24.                 else:
  25.                     print('welcome to system')
  26.                     return True


  27. flag = True
  28. while flag:
  29.     reminder = '''set new userdata(n/N)
  30.     olduser go(e/E)
  31.     out of system(q/Q)
  32.     please fill choice:'''
  33.     choice = input(reminder)
  34.     if choice not in ('q', 'Q', 'e', 'E', 'n', 'N'):
  35.         choice = ('fill wrong,plaese try again:')
  36.         continue
  37.     elif choice == 'e' or choice == 'E':
  38.         flag = olduser()
  39.     elif choice == 'n' or choice == 'N':
  40.         flag = newuser()
  41.     else:
  42.         print('have out system')
  43.         flag = False
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-9-17 21:00:25 | 显示全部楼层
2楼正解
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-27 09:19

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表