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

登录成功的情况:

登录失败的情况:

相关推荐
小柯南敲键盘12 小时前
跨马翻译批量图片视频字幕翻译,跨境电商AI智能抠图一站式工具
人工智能·python·音视频·xcode
2601_9622955812 小时前
Python中正则表达式的知识汇总分享
python·正则表达式·模块·语法·匹配
ellenwan202612 小时前
量化实现的难点,常在规则和流程
人工智能·python
2601_9622986712 小时前
正则表达式引擎 哪些
java·python·perl·pcre·正则表达式引擎
gf132111113 小时前
【python_回复邮件】
android·java·python
天空属于哈夫克313 小时前
企业微信API:企业微信机器人如何开发?
python·机器人·企业微信
Patrick在香港13 小时前
把 Claude 塞进 pandas 管道:7 条脏地址实测,5 条自动清洗、2 条被闸门拦下
python·pandas·etl·claude·数据清洗
二进制漫游记13 小时前
PostgreSQL超详细入门教程:Windows安装+Python异步连接+完整增删改查实战
python·postgresql
2601_9620776013 小时前
从零搭建Python接口自动化测试框架:pytest+requests实战指南
python·pytest·接口自动化·requests·框架搭建
stolentime13 小时前
OpenClaw 2.0 新手快速上手与实战指南
爬虫·python·ai·网络爬虫