Python study first week-account login Exercise

Source: Internet
Author: User

Python learning begins at the end of November 2017. Select Python 3.6.

Rough implementation of account login.

1 ImportGetpass2 3Wall =True4usr ='Root'5PASWD = 00006block_list = open ("Test.txt",'a')7 Print("Sign in!")8 9  forIinchRange (3, 0, 1):Ten     Print('{Time} time (s) left'. Format (time=i)) Oneusr_in = input ("Username:") Apaswd_in = Int (input ("Password:"))# -     #Password = getpass.getpass ("Password:") -  the      forLineinchOpen'Test.txt'): -         ifline = =usr: -             Print('Your account is blocked!') -Wall =False +              Break -  +     ifWall isFalse: A         Print('Call you admin!') at          Break -     elifusr = = usr_in andPaswd_in = =paswd: -         Print('------Welcome {_name}!------'. Format (_name=usr)) -          Break -     Else: -         ifI! = 1: in             Print('Invalid Password or username!\nplease try again!') -         Else: to             Print('Your account is Blocked!\ncall Your admin!') +Block_list.writelines ('{0}'. Format (usr)) -  theBlock_list.close ()

Python study first week-account login Exercise

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.