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 小时前
2.31 机器学习神器项目实战:如何在真实项目中应用XGBoost等算法
人工智能·python·算法·机器学习·ai·数据挖掘
智航GIS5 小时前
10.4 Selenium:Web 自动化测试框架
前端·python·selenium·测试工具
jarreyer5 小时前
摄像头相关记录
python
宝贝儿好5 小时前
【强化学习】第六章:无模型控制:在轨MC控制、在轨时序差分学习(Sarsa)、离轨学习(Q-learning)
人工智能·python·深度学习·学习·机器学习·机器人
大、男人5 小时前
python之asynccontextmanager学习
开发语言·python·学习
默默前行的虫虫6 小时前
nicegui文件上传归纳
python
一个没有本领的人6 小时前
UIU-Net运行记录
python
国强_dev6 小时前
Python 的“非直接原因”报错
开发语言·python
副露のmagic6 小时前
更弱智的算法学习 day24
python·学习·算法
廖圣平7 小时前
从零开始,福袋直播间脚本研究【三】《多进程执行selenium》
python·selenium·测试工具