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

登录成功的情况:

登录失败的情况:

相关推荐
ID_1800790547313 小时前
超详细:Python 调用淘宝商品详情 API 完整教程
开发语言·python
平常心cyk13 小时前
Python基础快速复习——函数的多种传参方式
python
lanboAI13 小时前
基于卷积神经网络的舌苔诊断系统,resnet50,alexnet, shufflenet模型【pytorch框架+python源码】
pytorch·python·cnn
QWsin13 小时前
【Pydantic】Pydantic 是什么?
python
WeeJot嵌入式13 小时前
爬虫对抗:ZLibrary反爬机制实战分析
爬虫·python·网络安全·playwright·反爬机制
Bert.Cai14 小时前
Python input函数作用
开发语言·python
Fairy要carry14 小时前
项目03-手搓Agent之团队协作(发消息/分配任务)
linux·前端·python
柚子+14 小时前
Appium+python+雷电模拟器自动化测试入门
数据库·python·appium
rgb2gray14 小时前
论文详解:基于POI与出租车轨迹的城市多中心结构静态-动态多重分形特征
人工智能·python·算法·机器学习·数据分析·可解释
github_czy14 小时前
Python 函数式编程利器:Partial 与 ParamSpec 技术解析
python·fastapi