Log in to write a Python function

demand: 

Write a program log,
1, up to the landing failed 3 times
2, the login is successful, suggesting welcome xx login, today's date is xxx, the program ends
3, to check whether the input is empty, the account number and password can not be blank
4, the account does not Case sensitive

 

datetime Import 

COUNT = 0
the while COUNT <. 3:

username = INPUT ( "username:")
pwd = INPUT ( "password:")
DATE = datetime.date.today ()

IF username.strip () == "" or pwd. Strip () == "":
Print ( "you entered is null, please re-enter")
COUNT = COUNT + 1
the Continue
elif username == "shenxianlu" and pwd == "123456":
Print ( "% S, Welcome Login, today's date is:% S "% (username, dATE))
BREAK
the else:
Print (" account password entered is incorrect. Please try again ")
COUNT = COUNT + 1
the else:
Print (" your three chances already exhausted, unable to continue to enter ")

question: how user names and passwords are not case sensitive, yet they get to know

Guess you like

Origin www.cnblogs.com/lapt/p/11456289.html