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

登录成功的情况:

登录失败的情况:

相关推荐
weixin_462446234 小时前
Python+React 专为儿童打造的汉字学习平台:从学前到小学的智能汉字教育解决方案
python·学习·react.js
河码匠4 小时前
Django rest framework 自定义url
后端·python·django
cnxy1884 小时前
Python Web开发新时代:FastAPI vs Django性能对比
前端·python·fastapi
weixin_462446234 小时前
【原创实践】Windows 和 Linux 下使用 Python 3.10 搭建 PaddleOCRVL 识别图片并100%还原表格
linux·windows·python·飞浆
ID_180079054734 小时前
除了Python,还有哪些语言可以解析淘宝商品详情API返回的JSON数据?
开发语言·python·json
Irene.ll5 小时前
DAY23
python
专注于大数据技术栈5 小时前
java学习--Collection的迭代器
java·python·学习
梨落秋霜12 小时前
Python入门篇【文件处理】
android·java·python
Java 码农13 小时前
RabbitMQ集群部署方案及配置指南03
java·python·rabbitmq
张登杰踩14 小时前
VIA标注格式转Labelme标注格式
python