← 返回题库
中级

类-登录尝试次数

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    class User:
        def __init__(____):
            self.first_name = first_name
            self.last_name = last_name
            self.login_attempts = ____
        def increment_login_attempts(____):
            self.login_attempts += ____
        def reset_login_attempts(____):
            self.login_attempts = ____
    user = User(____)
    user.increment_login_attempts()
    user.increment_login_attempts()
    print(____)
    user.reset_login_attempts()
    print(____)

示例

输入
solve()
期望输出
2
0
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码