原玛: username=input("nput username:") password=input("input password:") print(username) print(password) num=0 flag=0 while True: usr=input("input username:") if usr==username: while num3: word=input("input password:") if password==word
原玛:
username=input("nput username:")password=input("input password:")
print(username)
print(password)
num=0
flag=0
while True:
usr=input("input username:")
if usr==username:
while num<3:
word=input("input password:")
if password==word:
print("Success")
flag=1
break
else:
num+=1
if num<=2:
print("password error,again")
if flag==1:
break
num=0
print("password error three times, input again.")
else:
print("username error!")
运行结果: