运行环境:

python 3.7.4

程序代码:

#Author: Caesars
import datetime
print(datetime.datetime.now())
username = "Caesars"
password = "123456"
count = 0
while count < 3:
    name = input("please input your username:")
    pwd = input("please input your password:")
    if username == name and password == pwd:
        print("welcome %s login success!" %name)
        break
    else:
        print("your input name or password error")
    count += 1
    if count == 3:
        continue
    print("You have entered %d times,Cumulative error input three times,Your account will be locked!" %count)
if count >= 3:
    print("You have entered 3 times in total,Your account has been locked!")

 

posted on 2020-03-31 11:55  天王落尘之haohao  阅读(655)  评论(0编辑  收藏  举报