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

登录成功的情况:

登录失败的情况:

相关推荐
学掌门20 小时前
超级菜鸟怎么学习数据分析?
python·学习·数据分析
鸿芯微控科技20 小时前
压电纳米定位分辨率怎么测?噪声、带宽、最小可检测位移与Python分析
开发语言·python·噪声分析·压电执行器·纳米定位·位移测量
用户77833661321120 小时前
从 0 搭一个关键词排名监控:核心思路 + 可运行代码
后端·python·api
Fanta丶20 小时前
14.Python闭包、装饰器
python
码云骑士20 小时前
99-混合搜索Hybrid-Search-BM25-稀疏稠密向量-融合排序
python
金銀銅鐵20 小时前
[Python] 借助 Turtle 逐字展示《醉翁亭记》
python
用户70887690393821 小时前
给传统 SaaS 增加 AI 能力:3个真实落地场景
python
卷无止境21 小时前
FastAPI中间件全解析:请求处理链条上的隐形关卡
后端·python·fastapi
用户03321266636721 小时前
使用 Python 将 HTML 内容添加到 PowerPoint 演示文稿中
python·html