Skip to content

[解题分享] 56 #63

@bosens-China

Description

@bosens-China

您的答案 (Your Solution)

def repeat(num_times):
    """
    带参数的装饰器,用于重复执行一个函数。
    :param num_times: 函数需要被执行的次数
    """
    # 在这里写下你的代码
    def decorator(fn):
        def wrapper(*args, **kwargs):
            result = []
            for _ in range(num_times):
               result.append( fn(*args, **kwargs))
            return result
        return wrapper
    return decorator

解题思路 (Thought Process)

No response

其他信息 (Additional context)

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions