#!/user/bin/python# -*- coding:utf-8 -*-#当剩余为0次机会时.询问用户是否再试试.如果同意那就再给三次机会.可一直继续username = 'zd'password = '123'i = 0while i < 3 : name = input('用户名:') pwd = input('密码:') if username == name and password == pwd : print('登陆成功') break else: print('登陆失败,还…