模拟登录需求:
1. 用户输入帐号密码进行登陆
2. 账户输入错误直接退出,账户正确,密码错误3次锁定
i = 1infor = { 'zhanyie': 'abc123', 'jack': '123bca', 'tom': '132456' }name = input('please input your account: ')while i <= 3: if name not in infor.keys(): print('you need to register an account!') break else: pass_word = input('please input your password: ') for name_1 in infor.keys(): if name == name_1 and pass_word == infor[name_1]: print('Welcome') break elif i < 3 and name == name_1 and pass_word != infor[name_1]: print('your password is wrong,try again') i += 1 continue elif i == 3 and name == name_1 and pass_word != infor[name_1]: print('you are locked')