readme:涉及python知识点
- 数据类型
- 用户与程序交互
- while循环
- if..else判断
大致流程图:
基础需求:
- 让用户输入用户名密码
- 认证成功后显示欢迎信息
- 输错三次后退出程序
user_info={ ‘oath‘:{‘password‘:‘123‘}, ‘oath1‘:{‘password‘:‘123‘}, ‘oath2‘:{‘password‘:‘123‘}, } count = 0 while True: if count>2: break name=input("Please enter the user name:") if not name in user_info : print ("The user does not exist") count+=1 continue passwd=input("Please enter a secret:") if passwd == user_info[name]["password"]: print ("welcome to you") break else: print(‘wrong password‘) count+=1
升级需求:
- 可以支持多个用户登录 (提示,通过列表存多个账户信息)
- 用户3次认证失败后,退出程序,再次启动程序尝试登录时,还是锁定状态(提示:需把用户锁定的状态存到文件里)
时间: 2024-08-29 18:18:38