Python 自学 Day1
作业二:编写登陆接口
- 输入用户名密码
- 认证成功后显示欢迎信息
- 输错三次后锁定
#!/usr/bin/env python import getpass def log(): uname = input("input your uname:") upass = getpass.getpass("input your pass:") if uname == 'karyn' and upass == 'karyn': print("welcom login") exit(0) else: print("uname or upass invalid") count=0 while True: log() count +=1 if count>3: print("error too much") break