Article From:https://www.cnblogs.com/shiqijuemu/p/9970428.html

Requirement information:

Write a program to judge login:
The maximum number of errors is 3. No login is successful after entering 3 times. The number of errors is up to the limit.
Need to determine whether the input is empty or not, and input nothing, input a space, n spaces are empty

You can login with more than one user and choose to (multiple users login, each user’s password is different)

Knowledge points:

1.The combination of loop method while and for; 2. import using time function; 3. initial use of dictionary; 4. simple use of break and continue;

Ideas for realization:

1.Build a dictionary to store user information (key-value pairs store user accounts and passwords)

`   zhangmi={"wangdapang":"123456","wangerpang":"1234567","wangxiaopang":"7654321"}2.Use the for loop to fetch the dictionary data in turn　　for key,value in zhangmi.items():#items()Traversing dictionary contents3.Use the input statement to receive the user name and password to be judged`
`   shuru_user = input("Please enter a username: ")   shuru_pwd = input("Please enter your password: ")4.Comparing the input value with the data traversed from the dictionary`
`　　if shuru_user==key or shuru_pwd==value:    　　aaaa+=1#Counter    　　break#End cycle　　elif shuru_pwd!=value or shuru_user!=key:    　　continue#Used to jump out of the current cycle5.Number of Outer Cyclic Control Checks and Cyclic Checks`
`while cccc<=3:    count += 1#A counter for the number of checks    if count>3:        print("More than three times, you have no chance! ""        break    elif aaaa>=1:        print("Welcome to the oasis! The present time "+sj"#sj"is a variable that takes the current time.        break6.Determine whether the input value is null`
`if shuru_user=="" or shuru_pwd=="":    print("Number or password input is empty! ""    continue7.Introducing a timestamp to change the output format`
`import time,datetimesj=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())completeComplete Code: (a silly idea)`
`import time,datetimesj=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())zhangmi={"wangdapang":"123456","wangerpang":"1234567","wangxiaopang":"7654321"}count=0cccc=0aaaa=0while cccc<=3:    count += 1    if count>3:        print("More than three times, you have no chance! ""        break    elif aaaa>=1:        print("Welcome to the oasis! Now time "+sj"        break    shuru_user = input("Please enter a username: ")    shuru_pwd = input("Please enter your password: ")    if shuru_user=="" or shuru_pwd=="":        print("Number or password input is empty! ""        continue    for key,value in zhangmi.items():        # if shuru_user==key:        #     print("duiduidui")        if shuru_user==key or shuru_pwd==value:            aaaa+=1            break        elif shuru_pwd!=value or shuru_user!=key:            continue`