_user ="wuyan"
_passwd="gs19970623"
for i in range(3):
username=input("username:")
password=input("password:")
if username ==_user and password==_passwd:
print("wecome %s login..."%_user)
break
else:
print("用户名或密码错误,请重新输入")
else:
print("您已经错误三次,是否要修改密码?")
day5训练:登录程序-for循环,要求只能输入三次
最新推荐文章于 2023-09-13 23:26:23 发布
本文介绍了一个登录程序的实现,使用for循环控制用户只能有三次输入机会。通过这个程序,可以理解基本的用户输入验证和循环控制逻辑。
摘要由CSDN通过智能技术生成