A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
Implement a @timer decorator that wraps a function and prints its execution time. The decorator must support any args and kwargs. The test harness receives a list of function calls (each ['name', args, kwargs]) and expects a list of booleans indicating the timer worked.
Summary
Wrap any function to capture how long it takes.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.