Python Learn the first day-user name login quit

Source: Internet
Author: User

First, use input to obtain the user name and user password, and then compare the obtained information with the information stored by the computer. If the information is correct, the user is welcome. Users have a total of three input opportunities, the number of errors once more than three times, will lock the user.

1 #Coding=utf-82 #Version:python 3.6.03 #tools:pycharm 2017.3.24_date_ ='2018/4/15/015 17:04'5_author_ ='Hongyong'6 7Bob_username ="Bob"8Bob_password ="bob123"9 Ten  forIinchRange (3): OneUsername = input ("Please enter user name:") APassword = input ("Please enter your password:") -     Print(username, password) -  the     ifUsername = = Bob_username andPassword = =Bob_password: -         Print("Welcome {name} login!". Format (name =username)) -          Break -     Else: +         Print("It is wrong! Please try again!") - Else: +     Print("You had tried over 3 times, and the user had been locked!")
View Code

The python language supports Chinese.

The Python language is an interpreted mandatory type language.

Interpreted language is the side of the compilation side of the execution, translation language is a compilation completed and then executed.

Python Learn the first day-user name login quit

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.