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