python-007(用户登录(三次机会重试))

 1 # 用户登录(三次机会重试)
 2 i =0
 3 
 4 while i < 3:
 5     user = raw_input("username:")
 6     pwd = raw_input("password:")
 7     if user == "alex" and pwd == "123":
 8         print('YES')
 9         break
10     else:
11         print('try again')
12     i += 1
原文地址:https://www.cnblogs.com/bigdata-6/p/12862407.html