你这个里面有很多问题。。。。。。。对着看一下吧
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
|