From 996017f6dddc528e5449586c5d44dbe8ba16bf0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Hakan=20Y=C4=B1ld=C4=B1r=C4=B1m?= Date: Sat, 4 Apr 2026 02:52:44 +0300 Subject: [PATCH] Add Timer class with context management Implement a Timer class for measuring elapsed time. --- Week06/timer_ahmet_hakan_yildirim.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Week06/timer_ahmet_hakan_yildirim.py diff --git a/Week06/timer_ahmet_hakan_yildirim.py b/Week06/timer_ahmet_hakan_yildirim.py new file mode 100644 index 00000000..52312653 --- /dev/null +++ b/Week06/timer_ahmet_hakan_yildirim.py @@ -0,0 +1,13 @@ +import time + +class Timer: + def __init__(self): + self.start_time = 0.0 + self.end_time = 0.0 + + def __enter__(self): + self.start_time = time.time() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.end_time = time.time()