cun=0 while cun<3: aaa = {'name': 222, 'pass': 333} aaa1=int(input('请输入用户名')) if aaa1 in aaa.values(): aaa2=int(input('请输入密码')) if aaa2 in aaa.values(): print('登录成功') break elif cun>=3: print('密码错误超过三次,账户已被锁定') break else: print(f'密码输入错误,请重新输入,您还有{2-cun}次机会') else: if aaa1 not in aaa.values(): print('账号错误请重新输入') if cun==0: print('您还有两次机会') elif cun==1: print('您还有一次机会') elif cun==2: print('您的账号已锁定') cun+=1