From aabc7d374e3c3642ef75cd0f03e79260df6b2ce1 Mon Sep 17 00:00:00 2001 From: mantuhotep Date: Sat, 4 Apr 2026 16:17:38 +0300 Subject: [PATCH] Add Timer class for timing code execution --- Week06/timer_muhammet_topcu.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Week06/timer_muhammet_topcu.py diff --git a/Week06/timer_muhammet_topcu.py b/Week06/timer_muhammet_topcu.py new file mode 100644 index 00000000..2c7dae95 --- /dev/null +++ b/Week06/timer_muhammet_topcu.py @@ -0,0 +1,13 @@ +import time + +class Timer: + def __init__(self): + self.start_time = None + self.end_time = None + + def __enter__(self): + self.start_time = time.time() + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.end_time = time.time()