• 关于循环的作业:登陆程序


    要求写一段登陆程序:

    1、输入用户名和密码

    2、认证成功之后提示登陆成功

    3、如果用户名和密码输错3次,就强制退出

    #!/usr/bin/nev python
    #-*-coding:utf-8 -*-
    #Author :show530
    
    username = 'hongtao'
    password = '123456'
    
    for i in range(3):
        input_user = str(input("Please enter your name:  "))
        input_pass = str(input("Please enter your password:  "))
        if input_user == username and input_pass == password:
            print("33[7;37;42m==============================")
            print("Welcome,Login succeeded!!")
            print("==============================33[7;37;42m")
            print('33[0m')
            break
        else:
            print("33[7;31m==============================")
            print(" Incorrect username or password!!")
            print("==============================")
            print("You have "+str(2-i)+ " more chances!!")
            print("==============================33[1;37;40m")
            print('33[0m')
    else:
        print("33[7;31m==============================")
        print("Too many incorrect username or password for account !!")
        print("Prohibit further operations!")
        print("==============================33[1;31;40m")
        print('33[0m')
  • 相关阅读:
    [实战]MVC5+EF6+MySql企业网盘实战(11)——新建文件夹2
    [实战]MVC5+EF6+MySql企业网盘实战(10)——新建文件夹
    FMXUI
    x-superobject
    mORMot
    NativeXml
    superobject
    jsondataobjects
    QDAC
    DIOCP
  • 原文地址:https://www.cnblogs.com/show530/p/12378083.html
Copyright © 2020-2023  润新知