while循环与if循环

实例目的:熟悉while循环与if循环
#仿用户登录
_username="郭杰"
_password="guojie521125"

i=1#:输入的次数;当输入的次数大于3时,提示请找回密码
while i<=4:
if i==4:
print("请找回您的密码!")
name = input("name:")
password = input("password:")
if _username==name and _password==password:
print("欢迎%s登陆"%_username)
break;
else:
print("您的账号或密码不对")
i=i+1
posted @ 2018-01-23 19:17  郭祺迦  阅读(1750)  评论(0编辑  收藏  举报