ADD file via upload

main
p83ftenfl 5 months ago
parent 35688b0f3f
commit df5c32a12e

@ -0,0 +1,25 @@
# 假设的用户数据
USER_DATA = {
'username': 'admin',
'password': '1234'
}
# 尝试次数限制
MAX = 3
def login():
a = 0
while a < MAX:
n = input("请输入用户名:")
p = input("请输入密码:")
if USER_DATA['username'] == n and USER_DATA['password'] == p:
print("登录成功")
return True
else:
print("登录失败,用户名或密码错误")
a += 1
print(f"您还有 {MAX-a} 次尝试机会。")
print("登录失败次数过多,账户被锁定。")
return False
if __name__ == "__main__":
login()
Loading…
Cancel
Save