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

登录成功的情况:

登录失败的情况:

相关推荐
在世修行4 分钟前
干货:长任务反馈
python·长任务
东方芷兰10 分钟前
Agent 技术摘要 05 —— BP、SaaS、B2B、C2B、B2C
java·笔记·python·语言模型·自然语言处理
老歌老听老掉牙28 分钟前
麻花钻切削过程的力学与效率解析
python·钻头·切削
happylifetree33 分钟前
Python27:核心语法-流程控制语句-match模式匹配
python
奋进的LY1 小时前
spacy的安装和使用教程
人工智能·python·深度学习·github
znx9391 小时前
机器学习赋能量化交易:解锁新时代投资的核心竞争优势
人工智能·python·机器学习·期魔方
xzal121 小时前
Python 列表操作笔记:append / extend / + / pop
笔记·python
minji...1 小时前
LangGraph-AI智能体开发框架 - LangGraph 入门案例1 : 智能快递配送系统
人工智能·python·ai·langchain·大语言模型·agent·langgraph
Είναι η κοπέλα1 小时前
PyTorch 安装与验证
人工智能·pytorch·python
“AI国潮设计-小江”1 小时前
Python实战 | SDXL批量生成“潮汕英歌舞”国潮甜品IP,附核心Prompt与商用授权思路
开发语言·人工智能·python·prompt·aigc