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

登录成功的情况:

登录失败的情况:

相关推荐
卡次卡次144 分钟前
vibecoding起步注意点:插件、Skills、MCP、Hooks
服务器·数据库·python·oracle
我的xiaodoujiao1 小时前
API 接口自动化测试详细图文教程学习系列24--如何用Pytest去设计接口测试用例并执行
python·学习·测试工具·pytest
zhangfeng11331 小时前
ai 模型加密,强化版终极防盗方案 支持烧录的显卡列表
人工智能·pytorch·python
半个落月1 小时前
深入理解 Python dict 与 set:从哈希表底层到高性能实战
python
带派擂总1 小时前
Python全栈开发 Day10_用户管理系统
python
databook1 小时前
用 SymPy 解决 Manim 曲线绘制速度不均的问题
python·数学·动效
宇宙无敌程序员菜鸟1 小时前
浅玩CRUD Agent
python
程序大视界1 小时前
【Python系列课程】Python入门教程
开发语言·人工智能·python
morning_judger2 小时前
Agent系列(二)-记忆系统的设计
开发语言·python·机器学习
RSTJ_16252 小时前
PYTHON+AI LLM DAY SIXTY-ONE
开发语言·python