Build a decorator that limits how often a function can be called per second.
Constraints
Example
```python
import time
@rate_limit(max_per_second=2)
def greet(name):
return f"Hello {name}"
print(greet("Alice")) # Hello Alice
print(greet("Bob")) # Hello Bob
try:
greet("Charlie") # raises RuntimeError: Rate limit exceeded
except RuntimeError as e:
print(e) # Rate limit exceeded
time.sleep(1)
print(greet("Dave")) # Hello Dave
```
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints