技术栈

python模拟登录

太空漫步112024-07-09 11:01
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')        

登录成功的情况:

登录失败的情况:

上一篇:Android 性能为王时代SparseArray和HashMap一争高下
下一篇:Java智能之Spring AI:5分钟打造智能聊天模型的利器
相关推荐
Warson_L
1 天前
Python `Annotated` 与 LangGraph Reducer 学习笔记
python
韩师傅
1 天前
海天线算法的前世今生
python·计算机视觉
韩师傅
1 天前
当你的甲方设备过烂,要如何快速出效果?
python·计算机视觉
Warson_L
1 天前
LangGraph的MessageState and HumanMessage
python
韩师傅
1 天前
当你的甲方吐槽天空不够蓝,你应该如何应对
python·计算机视觉
Warson_L
1 天前
python的类&继承
python
Warson_L
1 天前
类型标注/type annotation
python
ThreeS
1 天前
手搓MiniVLA全实战教程-一步一步用pytorch解释原理与思路
人工智能·python
金銀銅鐵
1 天前
[Python] 模 n 乘法的逆元计算器
python·数学·游戏
热门推荐
012026年6月AI大模型全景报告:GPT-5.6、Claude Opus 4.8、Gemini 3.5,中美AI三足鼎立谁主沉浮?022026年6月AI行业全景:从百模大战到Agent元年,这30天发生了什么?032026 年 AI 编程工具终极横评:Cursor vs Claude Code vs Copilot vs Windsurf04飞书长连接_事件订阅(接收消息,审批任务状态变更)05Trae国际版与国内版深度测评:AI原生IDE的双生花06【AI】2026 年具身智能模型和世界模型总结07GitHub 镜像站点08Claude Code、Codex、Cursor三分天下:2026年AI编程Agent生态全景剖析092026年AI架构实战:彻底解决OpenAI接口超时与封号,Python调用GPT-5.2/Sora2企业级架构详解(附源码+压测报告)102026 AI 编程工具终极实战指南:Cursor vs Claude Code vs Copilot,开发者该怎么选?