From 7bf0eb1215d424e087830a6c9827d1b0dad63511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:38:10 +0300 Subject: [PATCH 1/9] Add student information for Batuhan Tunc --- Week01/info_batuhan_tunc.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Week01/info_batuhan_tunc.py diff --git a/Week01/info_batuhan_tunc.py b/Week01/info_batuhan_tunc.py new file mode 100644 index 00000000..60b3fdaf --- /dev/null +++ b/Week01/info_batuhan_tunc.py @@ -0,0 +1,2 @@ +student_id = "240315001" +full_name = "Batuhan Tunc" From 97f6a496014ceb251ce46ccc1417991e930f599f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:39:51 +0300 Subject: [PATCH 2/9] Add variable declarations for different types --- Week02/types_batuhan_tunc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Week02/types_batuhan_tunc diff --git a/Week02/types_batuhan_tunc b/Week02/types_batuhan_tunc new file mode 100644 index 00000000..4d572a94 --- /dev/null +++ b/Week02/types_batuhan_tunc @@ -0,0 +1,4 @@ +my_int = 10 +my_float = 10.5 +my_bool = True +my_complex = 1 + 2j From ed1aa29637ff8ca2bd7524b660e8ffc337259e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:43:49 +0300 Subject: [PATCH 3/9] Add function to calculate pyramid height from blocks --- Week03/pyramid_batuhan_tunc.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Week03/pyramid_batuhan_tunc.py diff --git a/Week03/pyramid_batuhan_tunc.py b/Week03/pyramid_batuhan_tunc.py new file mode 100644 index 00000000..cc0e189c --- /dev/null +++ b/Week03/pyramid_batuhan_tunc.py @@ -0,0 +1,8 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + needed = 1 + while number_of_blocks >= needed: + number_of_blocks -= needed + height += 1 + needed += 1 + return height From 270e174eb6eea2ab2ca2950b68ade48fdf52317d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:49:11 +0300 Subject: [PATCH 4/9] Add performance decorator with memory and time tracking Implement a performance decorator to measure execution time and memory usage. --- .../decorators_batuhan_tunc.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Week04/decorators_batuhan_tunc/decorators_batuhan_tunc.py diff --git a/Week04/decorators_batuhan_tunc/decorators_batuhan_tunc.py b/Week04/decorators_batuhan_tunc/decorators_batuhan_tunc.py new file mode 100644 index 00000000..3ac9f3fa --- /dev/null +++ b/Week04/decorators_batuhan_tunc/decorators_batuhan_tunc.py @@ -0,0 +1,31 @@ +import time +import tracemalloc + +def performance(func): + if not hasattr(performance, 'counter'): + performance.counter = 0 + performance.total_time = 0.0 + performance.total_mem = 0.0 + def wrapper(*args, **kwargs): + # 1. Ölçümleri Başlat + tracemalloc.start() + start_time = time.perf_counter() + + # 2. Asıl Fonksiyonu Çalıştır + result = func(*args, **kwargs) + + # 3. Ölçümleri Bitir + end_time = time.perf_counter() + current_mem, peak_mem = tracemalloc.get_traced_memory() + tracemalloc.stop() + + # 4. İstatistikleri Güncelle + performance.counter += 1 + performance.total_time += (end_time - start_time) + performance.total_mem += peak_mem + + return result + wrapper.__name__ = func.__name__ + wrapper.__doc__ = func.__doc__ + + return wrapper From 732ee2b7a6f3131a807f6654fc370f307328fcf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:49:59 +0300 Subject: [PATCH 5/9] Delete Week04/decorators_batuhan_tunc directory --- .../decorators_batuhan_tunc.py | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 Week04/decorators_batuhan_tunc/decorators_batuhan_tunc.py diff --git a/Week04/decorators_batuhan_tunc/decorators_batuhan_tunc.py b/Week04/decorators_batuhan_tunc/decorators_batuhan_tunc.py deleted file mode 100644 index 3ac9f3fa..00000000 --- a/Week04/decorators_batuhan_tunc/decorators_batuhan_tunc.py +++ /dev/null @@ -1,31 +0,0 @@ -import time -import tracemalloc - -def performance(func): - if not hasattr(performance, 'counter'): - performance.counter = 0 - performance.total_time = 0.0 - performance.total_mem = 0.0 - def wrapper(*args, **kwargs): - # 1. Ölçümleri Başlat - tracemalloc.start() - start_time = time.perf_counter() - - # 2. Asıl Fonksiyonu Çalıştır - result = func(*args, **kwargs) - - # 3. Ölçümleri Bitir - end_time = time.perf_counter() - current_mem, peak_mem = tracemalloc.get_traced_memory() - tracemalloc.stop() - - # 4. İstatistikleri Güncelle - performance.counter += 1 - performance.total_time += (end_time - start_time) - performance.total_mem += peak_mem - - return result - wrapper.__name__ = func.__name__ - wrapper.__doc__ = func.__doc__ - - return wrapper From fe3258179e44c1205b78837ed2952751c2bbc86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:50:59 +0300 Subject: [PATCH 6/9] Add performance decorator for function metrics Implement a performance decorator to measure execution time and memory usage. --- Week04/decorators_batuhan_tunc.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Week04/decorators_batuhan_tunc.py diff --git a/Week04/decorators_batuhan_tunc.py b/Week04/decorators_batuhan_tunc.py new file mode 100644 index 00000000..3ac9f3fa --- /dev/null +++ b/Week04/decorators_batuhan_tunc.py @@ -0,0 +1,31 @@ +import time +import tracemalloc + +def performance(func): + if not hasattr(performance, 'counter'): + performance.counter = 0 + performance.total_time = 0.0 + performance.total_mem = 0.0 + def wrapper(*args, **kwargs): + # 1. Ölçümleri Başlat + tracemalloc.start() + start_time = time.perf_counter() + + # 2. Asıl Fonksiyonu Çalıştır + result = func(*args, **kwargs) + + # 3. Ölçümleri Bitir + end_time = time.perf_counter() + current_mem, peak_mem = tracemalloc.get_traced_memory() + tracemalloc.stop() + + # 4. İstatistikleri Güncelle + performance.counter += 1 + performance.total_time += (end_time - start_time) + performance.total_mem += peak_mem + + return result + wrapper.__name__ = func.__name__ + wrapper.__doc__ = func.__doc__ + + return wrapper From 58b223f25fc8572d3053e017fa30c759218fa869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:52:13 +0300 Subject: [PATCH 7/9] Implement custom mathematical functions and counter Added custom_power and custom_equation functions with documentation. Implemented a counter function to track calls. --- Week04/functions_batuhan_tunc.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Week04/functions_batuhan_tunc.py diff --git a/Week04/functions_batuhan_tunc.py b/Week04/functions_batuhan_tunc.py new file mode 100644 index 00000000..4b18359d --- /dev/null +++ b/Week04/functions_batuhan_tunc.py @@ -0,0 +1,24 @@ +custom_power = lambda x = 0, / ,e = 1 : x**e + +def custom_equation(x : int = 0,y : int = 0,/,a : int = 1,b: int = 1,*,c: int = 1) -> float: + + """ + Calculates the mathematical equation. + + :param x: The first base value. + :param y: The second base value. + :param a: The exponent for x. + :param b: The exponent for y. + :param c: The divisor. + :return: The result of the equation. + """ + + res = float((x ** a + y**b) / c) + return res + +def fn_w_counter() -> (int,dict[str,int]): + if not hasattr(fn_w_counter, "counter"): + fn_w_counter.counter = 0 + fn_w_counter.counter += 1 + return fn_w_counter.counter, {__name__: fn_w_counter.counter} + From 7d041be6336bd1915b1e14ead2b2f9c526fe4f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:55:29 +0300 Subject: [PATCH 8/9] Add awaitme decorator for asynchronous functions --- Week05/awaitme_batuhan_tunc.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Week05/awaitme_batuhan_tunc.py diff --git a/Week05/awaitme_batuhan_tunc.py b/Week05/awaitme_batuhan_tunc.py new file mode 100644 index 00000000..06485d25 --- /dev/null +++ b/Week05/awaitme_batuhan_tunc.py @@ -0,0 +1,5 @@ +def awaitme(func): + async def init(*args,**kwargs): + result = func(*args,**kwargs) + return result + return init From fe64c87d74af12d96f788e2bef58296bad27ad72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Tun=C3=A7?= <58087692+Batuhaanccs@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:56:44 +0300 Subject: [PATCH 9/9] Add functions for removing duplicates and counting items --- Week03/sequences_batuhan_tunc.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Week03/sequences_batuhan_tunc.py diff --git a/Week03/sequences_batuhan_tunc.py b/Week03/sequences_batuhan_tunc.py new file mode 100644 index 00000000..9ab31292 --- /dev/null +++ b/Week03/sequences_batuhan_tunc.py @@ -0,0 +1,13 @@ +def remove_duplicates(seq:list) -> list: + return list(set(seq)) + + +def list_counts(seq: list) -> dict: + counts = {} + for item in seq: + counts[item] = counts.get(item, 0) + 1 + return counts + + +def reverse_dict(d: dict) -> dict: + return {v: k for k, v in d.items()}