pwd = "123456"
count = 0
max_count = 3

while count < max_count:
    user_input = input("请输入密码: ")

    if user_input == pwd:
        print("登录成功")
        break
    else:
        count += 1
        print("密码错误，您还有 {} 次机会".format(max_count - count))

        if count == max_count:
            print("输入密码达到三次，请稍后再登录。")
