zoukankan      html  css  js  c++  java
  • 【练习题】QQ登录练习

    QQ登录练习

    # 登录接口 账号密码,输入正确通过,输入错误,锁定
    #1.输入账号密码
    #2.判断账号密码正确通过,错误提示仅剩3次输入
    #3.第3次输入错误则锁定账户
    rightUser = "123"
    rightPwd = "qwe"
    fileobj_read = open("E:/test.txt","r+")
    times = int(fileobj_read.read(1))
    if times == 0:
        print("账户已被锁死!")
    else:
        print("登录QQ程序,请输入账号密码!")
    fileobj_read.close()
    while times <= 3 and times != 0:
        user = input("输入账号:")
        pwd = input("输入密码:")
        if user == rightUser and pwd == rightPwd:
            print("登录成功!")
            break
        else:
            times = times-1
            file_open = open("E:/test.txt","w+")
            file_open.write(str(times))
            file_open.close()
            print("输入账号或密码错误,您还剩余" + str(times) + "次机会输入,超过" + str(times) + "账户会锁死!")
    
  • 相关阅读:
  • 原文地址:https://www.cnblogs.com/surenliu/p/12736513.html
Copyright © 2011-2022 走看看