for x in range(1,10000000000000):
for i in range(1,4):
username = input("请输入您的用户名")
password = input("请输入您的密码")
name = "qinxiaokai"
passwd ="123456"
if username == name and password == passwd:
print("恭喜您已成功进入系统")
break
elif i ==3:
print("三次机会已用完,账户已封锁")
else:
print("账户或者密码错误,请重尝试,您还有%d次机会"%(3-i))
if username == name and password == passwd:
break
tip = input("三次机会已用完,您是否要继续 yes/no")
if tip =="yes":
continue
else:
print("您已安全退出系统")
break
模拟用户登陆系统,用户有三次机会,成功后进入系统,如果用完三次机会后账号封锁并且询问是否要继续尝试
于 2021-10-19 21:33:07 首次发布