print("欢迎来到登录界面")
U = "zhangsan"
P = "123456"
flag = 3
num = 0
a = 0
while a == 0:
username = input("input your username")
password = input("input your password")
if (username != U):
print("username is not existense, please try again")
elif (username == U and password != P):
print("you have", flag - num, "times")
if flag-num > 0:
print("your password is wrong, please try again")
num += 1
if (num > flag):
print("your account is locked, please go to the bank!")
a = 2
elif (username == U and password == P):
print("welcome back!")
print("Business is processing!")
a = 1
if (a == 1):
print("see you next day")
elif (a == 2):
print("you really should go to the bank")
游戏描述:
允许用户输错三次,三次后则锁定用户。
要点:(区别与上一篇)
- and 且连接符
- num +=1 自加
- != 不等