-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
您的答案 (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