Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def repeat(num_times):
- def decorator_repeat(func):
- def wrapper(*args, **kwargs):
- for _ in range(num_times):
- result = func(*args, **kwargs)
- return result
- return wrapper
- return decorator_repeat
- @repeat(num_times=3)
- def greet(name):
- print(f"Ciao, {name}!")
- greet("Dee")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement