while,for,if输入账号密码判断
AccountNumber1 = [] password1 = [] flag = True while flag: num = 0 a = 1 print('-----------这是个欢迎界面---------------') print(''' 1、注册账号 2、登陆账号 3、更改密码 ''') num=input() if num==1: while a<2: AccountNumber=input('请您注册账号') if AccountNumber1.count(AccountNumber)==0: AccountNumber1.append(AccountNumber) print('您的账号是{}'.format(AccountNumber)) else: print('{}这个账号已经被注册过咯!请进行其他操作!'.format(AccountNumber)) break password=input('请注册您的密码') if password1.count(password)==0: # print(password1.count(password1)) password1.append(password) print('您的密码是{}'.format(password)) a+=1 if num==2: x=-1 EnterAccount=input('请输入您的账号') Enterpassword=input ('请输入您的密码') for i in AccountNumber1: x+=1 if i==EnterAccount: if password1[x]==Enterpassword: print('登陆成功!') flag = False break else: print("密码不正确") else: print('账号不存在') else: print('账号不存在') if num == 3: x = -1 for i in AccountNumber1: x += 1 AccountNumber = input('请输入您的账号') OldPassword = input('请输入您的旧密码') if i == AccountNumber: if password1[x] == OldPassword: NewPassword=input('输入您的新密码') password1[x]=NewPassword print('修改完毕!') flag = False break else: print("密码错误,请重新输入旧密码") else: print('账号不存在或错误') else: print('账号不存在')