1. 登录作业:
写一个登录程序,登录成功之后,提示 XXX 欢迎登录,登录失败次数是 3 次,要校验一下输入为空的情况
- for i in range(3):
- username=input('username:').strip()
- passwd=input('passwd:').strip()
- if username and passwd:
- if username=='weixiaocui' and passwd=='123456':
- print('%s欢迎登录'%username)
- break
- else:
- print('账号/密码错误')
- else:
- print('账号/密码不能为空')
- else:
- print('错误失败次数太多!')