Day01 login module, day01loginmodule

Source: Internet
Author: User

Day01 login module, day01loginmodule

Knowledge Point: Two formats of module import variable assignment format the output for loop if... else nesting

#!C:\Program Files\Python35/bin# -*- conding:utf-8 -*-# author: Frankimport getpassuser,passwd= 'Frank','oldboy_python'msg = '''Information of %s person:NAME: %sAGE:  %sJOB:  %sID :  %s''' %(user,user, 21, 'IT Engineer',3714)input_time = 1for i in range(5):        print("-----input %d time-----" %int((input_time)))        username = input("please input your name:")     #   password = getpass.getpass("please input your password:")        password = input("please input your password:")        if username == user and password == passwd :            print("%s Welcom to login on" %(user))            info_confirm = input("If you need double check your personal inform yes/no:")            if info_confirm == 'yes':                print(msg)                break            else:                print("please go ahead")                break        else :            if input_time == 3:                print("Your input has 3 times wrong , your account will be locked")                exit()            else:               print("Your user or password is invalid , pleasre re_input!")               input_time += 1

Test results:

# Test 1 ----- input 1 time ----- please input your name: frankplease input your password: dmfkdfYour user or password is invalid, pleasre re_input! ----- Input 2 time ----- please input your name: frankplease input your password: kdfYour user or password is invalid, pleasre re_input! ----- Input 3 time ----- please input your name: Frkdfkplease input your password: mskYour input has 3 times wrong, your account will be locked # Test 2 ----- input 1 time ----- please input your name: frankplease input your password: oldboy_pythonFrank Welcom to login onIf you need double check your personal inform yes/no: yesInformation of Frank person: NAME: FrankAGE: 21JOB: IT EngineerID: 3714 # Test 3: ----- input 1 time ----- please input your name: frakplease input your password: mksf34Your user or password is invalid, pleasre re_input! ----- Input 2 time ----- please input your name: mddifplease input your password: frank3235Your user or password is invalid, pleasre re_input! ----- Input 3 time ----- please input your name: Frankplease input your password: oldboy_pythonFrank Welcom to login onIf you need double check your personal inform yes/no: noplease go ahead

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.