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')        

登录成功的情况:

登录失败的情况:

相关推荐
半兽先生7 小时前
大模型技术开发与应用——5.大模型Agent开发(CrewAI)
大数据·人工智能·python·机器学习·ai
眼泪划过的星空7 小时前
快速了解LangGraph:构建智能Agent工作流的核心框架
人工智能·python·langchain
IsSh9nj6q7 小时前
Python全栈应用搭建神器magic-dash .新版本介绍
开发语言·python·dash
Cachel wood8 小时前
hands-on-modern-rl:动手学强化学习策略梯度reinforce
开发语言·python
蓝斯4978 小时前
一碰即传,重构跨设备文件分享体验
开发语言·python·重构
寒水馨8 小时前
macOS下载、安装uv-0.12.0(附安装包uv-aarch64-apple-darwin.tar.gz)
python·macos·rust·项目管理·包管理器·astral·pip替代
码云骑士9 小时前
85-Prompt是一门工程-结构化分层-System-vs-User-Prompt
python·prompt
qq_22589174669 小时前
基于Python的中药药材数据可视化分析系统
python·机器学习·数据分析·django
卷无止境9 小时前
LangExtract:让LLM从杂乱文本中"抠"出结构化数据的开源工具
后端·python