python 验证输入的帐号和密码

原玛:

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!")

运行结果:

 

 

 
posted @ 2021-04-10 23:43  bobo哥  阅读(740)  评论(0编辑  收藏  举报