写代码:实现用户输入用户名和密码,当用户名为seven且密码为123时,显示登陆成功,不然失败,失败时容许重复输入三次。

# 实现用户输入用户名和密码,当用户名为seven且密码为123时,显示登陆成功,不然失败,失败时容许重复输入三次。


count = 0

while count < 3:
username = input("Please enter your username: ")
password = input("Please enter your password: ")
if username == "seven" and password == "123":
print("login successful.")
break
else:
print("login failed.")
count += 1

if count == 3:
print("the max input is 3 times. ")
相关文章
相关标签/搜索