From ae70109ef48b4554def0221ea7ea42e544e4ccc3 Mon Sep 17 00:00:00 2001 From: Ebrukoksal <114864294+Ebrukoksal@users.noreply.github.com> Date: Tue, 31 Mar 2026 12:55:16 +0300 Subject: [PATCH] Add Timer class with context manager support Implement a Timer class for measuring elapsed time. --- Week06/timer_ebru_koksal.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Week06/timer_ebru_koksal.py diff --git a/Week06/timer_ebru_koksal.py b/Week06/timer_ebru_koksal.py new file mode 100644 index 00000000..bde6201c --- /dev/null +++ b/Week06/timer_ebru_koksal.py @@ -0,0 +1,13 @@ +import time + +class Timer: + def __init__(self): + self.start_time = 0 + self.end_time = 0 + + def __enter__(self): + self.start_time = time.time() + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.end_time = time.time()