-
基础需求: 让用户输入用户名密码 认证成功后显示欢迎信息 输错三次后退出程序 升级需求: 可以支持多个用户登录 (提示,通过列表存多个账户信息) 用户3次认证失败后,退出程序,再次启动程序尝试登录时,还是锁定状态(提示:需把用户锁定的状态存到文件里)
- 基础需求
count =1
password='123abc'
while count <3:
user_password=str(input("please input password:"))
if user_password==password:
print("welcome!!")
break
else:
print("password error!!")
count+=1 - 升级需求
L=['abc123','123abc','1234ab']
count=0
user_name=int(input("please input your name"))
while count<3:
user_password = str(input("please input password:"))
if user_password==L[user_name]:
print("welcome!!")
break
else:
print("password error!!")
count+=1
python homework1 编写登陆认证程序
猜你喜欢
转载自www.cnblogs.com/andydong/p/9150708.html
今日推荐
周排行