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

登录成功的情况:

登录失败的情况:

相关推荐
天天进步20151 小时前
Python全栈实战:基于机器学习的用户行为分析系统
python
linzeyang1 小时前
Advent of Code 2025 挑战全手写代码 Day 5 - 餐厅
后端·python
祝余Eleanor1 小时前
Day 29 类的定义及参数
人工智能·python·机器学习
码界奇点1 小时前
基于Dash+FastAPI的通用中后台管理系统设计与实现
python·车载系统·毕业设计·fastapi·源代码管理·dash
white-persist1 小时前
【攻防世界】reverse | Mysterious 详细题解 WP
c语言·开发语言·网络·汇编·c++·python·安全
小oo呆2 小时前
【学习心得】Python好库推荐——pipx
linux·开发语言·python
smile_Iris2 小时前
Day 28 元组和OS模块
python·机器学习
AI科技星2 小时前
时空运动的几何约束:张祥前统一场论中圆柱螺旋运动光速不变性的严格数学证明与物理诠释
服务器·数据结构·人工智能·python·科技·算法·生活
AIsdhuang2 小时前
2025 AI培训权威榜:深度评测与趋势前瞻
人工智能·python·物联网
m0_726965982 小时前
RAG小实战
开发语言·python