|
5鱼币
- userdata={}
- def newuser():
- name=input('what is your name:')
- if name in userdata:
- name=input('this name has been used,please fill a new:')
- continue
- else:
- break
- key=input('please set a password:')
- print('successful,go for a try')
- userdata[name]=key
- def olduser():
- name=input('what is your name:')
- if name not in userdata:
- name=input('this name do not find,please fill again:')
- continue
- else:
- break
- key=input('please fill password:')
- if key != userdata.pop(name):
- key=input('password is wrong,please fill again:')
- continue
- else:
- print('welcome to system')
- while choosen:
- reminder='''set new userdata(n/N)
- olduser go(e/E)
- out of system(q/Q)
- please fill choice:'''
- choice=input(reminder)
- if choice not in ('q','Q','e','E','n','N'):
- choice=('fill wrong,plaese try again:')
- continue
- elif choice=='e' or choice=='E':
- def olduser()
- elif choice=='n' or choice=='N':
- def newuser()
- else:
- print('have out system')
- choosen=0
-
-
-
-
-
-
-
-
复制代码
#为什么会报错?
你这个里面有很多问题。。。。。。。对着看一下吧
- userdata = {'111': '111'}
- def newuser():
- name = input('what is your name:')
- while True:
- if name not in userdata.keys():
- key = input('please set a password:')
- print('successful,go for a try')
- userdata[name] = key
- return True
- else:
- name = input('this name has been used,please fill a new:')
- continue
- def olduser():
- name = input('what is your name:')
- while True:
- if name not in userdata:
- name = input('this name do not find,please fill again:')
- continue
- else:
- key = input('please fill password:')
- while True:
- if key != userdata[name]:
- key = input('password is wrong,please fill again:')
- else:
- print('welcome to system')
- return True
- flag = True
- while flag:
- reminder = '''set new userdata(n/N)
- olduser go(e/E)
- out of system(q/Q)
- please fill choice:'''
- choice = input(reminder)
- if choice not in ('q', 'Q', 'e', 'E', 'n', 'N'):
- choice = ('fill wrong,plaese try again:')
- continue
- elif choice == 'e' or choice == 'E':
- flag = olduser()
- elif choice == 'n' or choice == 'N':
- flag = newuser()
- else:
- print('have out system')
- flag = False
复制代码
|
最佳答案
查看完整内容
你这个里面有很多问题。。。。。。。对着看一下吧
|