编写登录接口
让用户输入用户名密码
认证成功后显示欢迎信息
输错三次后退出程序
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 count=1 2 while count < 4: 3 name = input('name:') 4 password = input('password:') 5 if name=='egon' and password=='123': 6 print('欢迎登录') 7 break 8 else: 9 print('不好意思,您已经输错%s次' %count) 10 if count == 3: 11 break 12 print('请重新输入,hahaha') 13 count+=1