Python习题-登录

写一个登录的程序,失败次数最多为3次,输入账号、密码错误,提示账号/密码错误。失败三次程序退出,输入正确,提示欢迎xxx登录
i=0
while (i<3):
username = input('请输入登录账号:')
password = input('请输入密码:')

if username=="niuniu" and password=="123":
print('hello,%s'%username)
break
else:
print('you are error,try again')
i=i+1
else:
print('you error over 3 times')

原文地址:https://www.cnblogs.com/niuniu2018/p/7696218.html