当前位置 : 主页 > 编程语言 > python >

python 验证输入的帐号和密码

来源:互联网 收集:自由互联 发布时间:2022-06-15
原玛: 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!")

运行结果:

 python 验证输入的帐号和密码_Python

 


网友评论