Build a context manager that times code blocks and stores elapsed time.
Constraints
Example
# Example usage:
import time
t = Timer()
with t:
time.sleep(0.01)
assert t.elapsed >= 0.01
# Another example:
t2 = Timer()
with t2:
pass
assert t2.elapsed >= 0.0
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints