课后练习:用户登录(三次机会重试)

 1 count = 0
 2 while count < 3:
 3     user = input("输入用户名:")
 4     pwd = input("输入密码")
 5     if user == 'alex' and pwd =='123':
 6         print("欢迎登陆")
 7         break
 8     else:
 9         print("用户名或密码错误")
10     count = count + 1
原文地址:https://www.cnblogs.com/xhdy/p/14264662.html