From 85e970dd53804a18c434e3e86d11e146a4e53050 Mon Sep 17 00:00:00 2001 From: Cem AYYILDIZ Date: Tue, 7 Apr 2026 07:33:04 +0300 Subject: [PATCH 1/4] Add function to calculate pyramid height from blocks --- Week03/pyramid_cem_ayyildiz.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Week03/pyramid_cem_ayyildiz.py diff --git a/Week03/pyramid_cem_ayyildiz.py b/Week03/pyramid_cem_ayyildiz.py new file mode 100644 index 00000000..ac816c41 --- /dev/null +++ b/Week03/pyramid_cem_ayyildiz.py @@ -0,0 +1,10 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + required_blocks = 1 + + while number_of_blocks >= required_blocks: + number_of_blocks -= required_blocks + height += 1 + required_blocks += 1 + + return height From 61b8972470e6172e8b34ddfe7881554eed04c504 Mon Sep 17 00:00:00 2001 From: Cem AYYILDIZ Date: Tue, 7 Apr 2026 07:37:34 +0300 Subject: [PATCH 2/4] Add performance decorator with time and memory tracking Implement a performance decorator to measure execution time and memory usage. --- Week04/decorators_cem_ayyildiz.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Week04/decorators_cem_ayyildiz.py diff --git a/Week04/decorators_cem_ayyildiz.py b/Week04/decorators_cem_ayyildiz.py new file mode 100644 index 00000000..72c94441 --- /dev/null +++ b/Week04/decorators_cem_ayyildiz.py @@ -0,0 +1,27 @@ +import time +import tracemalloc + +def performance(func): + def wrapper(*args, **kwargs): + if not hasattr(performance, "counter"): + performance.counter = 0 + performance.total_time = 0 + performance.total_mem = 0 + + performance.counter += 1 + tracemalloc.start() + start_time = time.perf_counter() + result = func(*args, **kwargs) + end_time = time.perf_counter() + current, peak = tracemalloc.get_traced_memory() + tracemalloc.stop() + + performance.total_time += (end_time - start_time) + performance.total_mem += peak + + return result + + wrapper.__name__ = func.__name__ + wrapper.__doc__ = func.__doc__ + + return wrapper From 79be12347ba8121c872144b17d179eb85648334f Mon Sep 17 00:00:00 2001 From: Cem AYYILDIZ Date: Tue, 7 Apr 2026 07:38:45 +0300 Subject: [PATCH 3/4] Implement custom power and equation functions Added custom power and equation functions along with a counter function. --- Week04/functions_cem_ayyildiz.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Week04/functions_cem_ayyildiz.py diff --git a/Week04/functions_cem_ayyildiz.py b/Week04/functions_cem_ayyildiz.py new file mode 100644 index 00000000..483539a0 --- /dev/null +++ b/Week04/functions_cem_ayyildiz.py @@ -0,0 +1,20 @@ +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 : + """ + This function returns the result of an operation based on the specified base and exponent values. + + :param x: First base value + :param y: Second base value + :param a: First exponent value + :param b: Second exponent value + :param c: Divisor value + :return: (x**a + y**b)/c + """ + return (x**a + y**b)/c + +def fn_w_counter() -> (int, dict[str, int]): + if not hasattr(fn_w_counter, "count"): + fn_w_counter.count = 0 + fn_w_counter.count += 1 + return fn_w_counter.count, {__name__.split('.')[-1]: fn_w_counter.count} From d7c76f3a495079a7ce16fd531f9e90a902e7619b Mon Sep 17 00:00:00 2001 From: Cem AYYILDIZ Date: Tue, 7 Apr 2026 07:40:55 +0300 Subject: [PATCH 4/4] Add awaitme decorator for asynchronous functions --- Week05/awaitme_cem_ayyildiz.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Week05/awaitme_cem_ayyildiz.py diff --git a/Week05/awaitme_cem_ayyildiz.py b/Week05/awaitme_cem_ayyildiz.py new file mode 100644 index 00000000..75dfc4d1 --- /dev/null +++ b/Week05/awaitme_cem_ayyildiz.py @@ -0,0 +1,4 @@ +def awaitme(func): + async def wrapper(*args, **kwargs): + return func(*args, **kwargs) + return wrapper