python模拟登录

python 复制代码
i=0
while i<3:
    user_name=input("Enter your name:")
    pwd=input('Enter your password:')
    if user_name=='******' and pwd=='*****':
        print('Welcome',user_name,' to the system')
        i=8
    else:
        if i<2:
            print('Wrong username or password,you have ',2-i,'chances left')
        i+=1
if i==3:
    print('You have entered wrong username or password three times,you have been locked')        

登录成功的情况:

登录失败的情况:

相关推荐
basketball6163 分钟前
Python FastAPI 介绍以及常用方法
python·fastapi·vllm·ai infra
论文复现现场22 分钟前
企业知识库 RAG 用什么模型便宜?GLM-5.3-Flash 长文本 API 实测
python·rag·企业知识库·大模型api·glm-5.3-flash
梦在远山后44 分钟前
从手写 Loop 到可恢复 Runtime:用 LangGraph、PostgreSQL Checkpoint 与 AG-UI 跑通中断恢复
python·langchain·agent
Yolanda_20221 小时前
8.tensorboard的使用
python
用户0332126663671 小时前
使用 Python 添加、隐藏或删除 PowerPoint 幻灯片
python
言乐62 小时前
Python关键词抓取目标网站
python·django·virtualenv·pygame·tornado
用户7783366132112 小时前
搜索页的 URL 状态管理:可分享、可回退、可刷新
python·api
Liaiyang662 小时前
空圈容错视角下的无人机全链路审计:从理论框架到耦合式检验
人工智能·pytorch·python·深度学习·系统架构·自动驾驶·无人机
liuchangng2 小时前
Jev 模型研究:从生成式大模型到决策式模型——System One、RLCD 校准与采用边界
java·javascript·人工智能·python·深度学习
微小冷2 小时前
patsy:Python中的统计建模语法
python·统计·建模·patsy·statmodels