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 小时前
Ansible 实战:典型使用场景、Playbook 编写与 Python 调用接口详解
python·servlet·ansible
萧子琦9 小时前
不装 C++ Snappy 也能秒解 LevelDB .ldb?拿 3 套公开取证靶场对拍 StarShield v0.4.1、dfindexeddb 与 strings
python
JonaHu10 小时前
GPT Image 2.6 商品图横竖版适配:安全区、留白与裁切预检
图像处理·人工智能·python·aigc
Fancy.76110 小时前
Python变量与基础数据类型学习总结
python
泡海椒11 小时前
Java 生成资金流向图 PDF:jquick-pdf 树图(JTreeChartData)节点尺寸与间距的追问记录
java·python·pdf
钱栈up12 小时前
奥迪上汽拍板「三年三款」,合资阵营的换挡节奏终于跟上了
爬虫·python·数据分析
东莞市云毅网络有限公司12 小时前
SQLite FTS5 做中文问答检索:分词、排序与召回测试
python·sqlite·自动化运维·geo·数据监测
timeDifference₇1 天前
Python Vibe Coding实操实验报告
开发语言·jvm·python
geovindu1 天前
python:DecisionTree
开发语言·后端·python·算法
怒放的生命19911 天前
代码知识库 RAG 问答系统 —— 从 0 到 1 实现教程
python·状态模式·fastapi·全栈开发·ai agent应用开发