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

 

posted @ 2020-05-10 10:38  haven_rui  阅读(193)  评论(0编辑  收藏  举报