From 4e08e0c1d2caa467349dbc52b6206c585b065061 Mon Sep 17 00:00:00 2001 From: protagonist9 Date: Wed, 22 Oct 2025 02:39:02 +0300 Subject: [PATCH 1/4] Created pyramid_first_last.py --- Week03/pyramid_first_last.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Week03/pyramid_first_last.py diff --git a/Week03/pyramid_first_last.py b/Week03/pyramid_first_last.py new file mode 100644 index 00000000..fa762647 --- /dev/null +++ b/Week03/pyramid_first_last.py @@ -0,0 +1,7 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + while(number_of_blocks >= 0): + height += 1 + number_of_blocks -= height + return height - 1 + From 043bf57b098602f279d0cedd12bc1267a65a3703 Mon Sep 17 00:00:00 2001 From: protagonist9 Date: Mon, 27 Oct 2025 18:48:32 +0300 Subject: [PATCH 2/4] Created pyramid_tarik_bozgan.py --- Week03/{pyramid_first_last.py => pyramid_tarik_bozgan.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Week03/{pyramid_first_last.py => pyramid_tarik_bozgan.py} (100%) diff --git a/Week03/pyramid_first_last.py b/Week03/pyramid_tarik_bozgan.py similarity index 100% rename from Week03/pyramid_first_last.py rename to Week03/pyramid_tarik_bozgan.py From 53ed69c515025348e42ff3d4230962be75f6cade Mon Sep 17 00:00:00 2001 From: protagonist9 Date: Sun, 16 Nov 2025 19:34:56 +0300 Subject: [PATCH 3/4] Created sequences_tarik_bozgan.py --- Week03/sequences_tarik_bozgan.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Week03/sequences_tarik_bozgan.py diff --git a/Week03/sequences_tarik_bozgan.py b/Week03/sequences_tarik_bozgan.py new file mode 100644 index 00000000..1ba02067 --- /dev/null +++ b/Week03/sequences_tarik_bozgan.py @@ -0,0 +1,23 @@ +def remove_duplicates(seq): + result = [] + for item in seq: + if item not in result: + result.append(item) + return result + + +def list_counts(seq): + counts = {} + for item in seq: + if item in counts: + counts[item] += 1 + else: + counts[item] = 1 + return counts + + +def reverse_dict(d): + reversed_dict = {} + for key, value in d.items(): + reversed_dict[value] = key + return reversed_dict \ No newline at end of file From 75f708ff7b9f990d187eae22dc2335bc39bcf8bc Mon Sep 17 00:00:00 2001 From: protagonist9 Date: Thu, 4 Dec 2025 18:10:59 +0300 Subject: [PATCH 4/4] Week04 homeworks done --- Week04/decorators_tarik_bozgan.py | 21 +++++++++++++++++++++ Week04/functions_tarik_bozgan.py | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Week04/decorators_tarik_bozgan.py create mode 100644 Week04/functions_tarik_bozgan.py diff --git a/Week04/decorators_tarik_bozgan.py b/Week04/decorators_tarik_bozgan.py new file mode 100644 index 00000000..9200e400 --- /dev/null +++ b/Week04/decorators_tarik_bozgan.py @@ -0,0 +1,21 @@ +import time +import tracemalloc + +def performance(func): + func.counter = 0 + func.total_time = 0 + func.total_mem = 0 + + def wrapper(*args, **kwargs): + func.counter += 1 + start_time = time.perf_counter() + tracemalloc.start() + result = func(*args, **kwargs) + current, peak = tracemalloc.get_traced_memory() + tracemalloc.stop() + func.total_time += (time.perf_counter() - start_time) + func.total_mem += peak + + return result + + return wrapper diff --git a/Week04/functions_tarik_bozgan.py b/Week04/functions_tarik_bozgan.py new file mode 100644 index 00000000..f3645f6a --- /dev/null +++ b/Week04/functions_tarik_bozgan.py @@ -0,0 +1,21 @@ +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: + """ + Calculate a custom equation: (x**a + y**b) / c + + :param x: First base value (positional-only) + :param y: Second base value (positional-only) + :param a: Exponent for x (positional-or-keyword) + :param b: Exponent for y (positional-or-keyword) + :param c: Divisor (keyword-only) + :return: The result of (x**a + y**b) / c + :rtype: float + """ + return (x**a + y**b) / c + +def fn_w_counter(_calls={"__main__": 0}): + _calls["__main__"] += 1 + return _calls["__main__"], dict(_calls) + +