From ecdb5a66ea9c106d81f2e88805897b5ff29dade8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra=20=C3=96zt=C3=BCrk?= Date: Tue, 29 Sep 2026 17:18:01 +0300 Subject: [PATCH 1/8] =?UTF-8?q?Add=20student=20information=20for=20Bu?= =?UTF-8?q?=C4=9Fra=20=C3=96zt=C3=BCrk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Week01/info_bugra_ozturk.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Week01/info_bugra_ozturk.py diff --git a/Week01/info_bugra_ozturk.py b/Week01/info_bugra_ozturk.py new file mode 100644 index 000000000..381cbac09 --- /dev/null +++ b/Week01/info_bugra_ozturk.py @@ -0,0 +1,2 @@ +student_id = "230316041" +full_name = "Buğra Öztürk" From f71c2d0c27eac6bae95dd72779c4b2a21668bcdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra=20=C3=96zt=C3=BCrk?= Date: Wed, 28 Oct 2026 18:59:13 +0300 Subject: [PATCH 2/8] Add variables of different types in types_bugra_ozturk.py --- Week02/types_bugra_ozturk.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Week02/types_bugra_ozturk.py diff --git a/Week02/types_bugra_ozturk.py b/Week02/types_bugra_ozturk.py new file mode 100644 index 000000000..3fa0f5e32 --- /dev/null +++ b/Week02/types_bugra_ozturk.py @@ -0,0 +1,4 @@ +my_int = 25 +my_float = 3.14 +my_bool = True +my_complex = 2 + 3j From 6b0ce98da1b5f3d404809ea73bf1017f4cf04e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra=20=C3=96zt=C3=BCrk?= Date: Wed, 28 Oct 2026 19:00:23 +0300 Subject: [PATCH 3/8] Add function to calculate pyramid height from blocks --- Week03/pyramid_bugra_ozturk.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Week03/pyramid_bugra_ozturk.py diff --git a/Week03/pyramid_bugra_ozturk.py b/Week03/pyramid_bugra_ozturk.py new file mode 100644 index 000000000..98ce056b2 --- /dev/null +++ b/Week03/pyramid_bugra_ozturk.py @@ -0,0 +1,7 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + used_blocks = 0 + while used_blocks + (height + 1) <= number_of_blocks: + height += 1 + used_blocks += height + return height From a8e0eea22536a9278a0ab80105b423de8aa16e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra=20=C3=96zt=C3=BCrk?= Date: Wed, 28 Oct 2026 19:02:03 +0300 Subject: [PATCH 4/8] Implement custom power and equation functions Added custom_power function and custom_equation for calculations. --- Week04/functions_bugra_ozturk.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Week04/functions_bugra_ozturk.py diff --git a/Week04/functions_bugra_ozturk.py b/Week04/functions_bugra_ozturk.py new file mode 100644 index 000000000..ef57818c1 --- /dev/null +++ b/Week04/functions_bugra_ozturk.py @@ -0,0 +1,27 @@ +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 result of the equation (x**a + y**b) / c. + + :param x: First base, positional-only + :param y: Second base, positional-only + :param a: Exponent of x + :param b: Exponent of y + :param c: Divisor, keyword-only + :return: Result of (x**a + y**b) / c as a float + """ + for name, value in (("x", x), ("y", y), ("a", a), ("b", b), ("c", c)): + if not isinstance(value, int): + raise TypeError(f"{name} must be an integer") + return (x ** a + y ** b) / c + + +def fn_w_counter() -> (int, dict[str, int]): + if not hasattr(fn_w_counter, "total"): + fn_w_counter.total = 0 + fn_w_counter.callers = {} + fn_w_counter.total += 1 + fn_w_counter.callers[__name__] = fn_w_counter.callers.get(__name__, 0) + 1 + return fn_w_counter.total, fn_w_counter.callers From 0d22765c12ad5c6a40e3c8b61ac4793404681d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra=20=C3=96zt=C3=BCrk?= Date: Wed, 28 Oct 2026 19:03:04 +0300 Subject: [PATCH 5/8] Implement utility functions for list and dict operations Added functions to remove duplicates, count occurrences, and reverse dictionary. --- Week03/sequences_bugra_ozturk.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Week03/sequences_bugra_ozturk.py diff --git a/Week03/sequences_bugra_ozturk.py b/Week03/sequences_bugra_ozturk.py new file mode 100644 index 000000000..b9074067a --- /dev/null +++ b/Week03/sequences_bugra_ozturk.py @@ -0,0 +1,28 @@ +def remove_duplicates(seq: list) -> list: + """ + This function removes duplicates from a list. + """ + result = [] + for item in seq: + if item not in result: + result.append(item) + return result + + +def list_counts(seq: list) -> dict: + """ + This function counts the number of + occurrences of each item in a list. + """ + counts = {} + for item in seq: + counts[item] = counts.get(item, 0) + 1 + return counts + + +def reverse_dict(d: dict) -> dict: + """ + This function reverses the keys + and values of a dictionary. + """ + return {value: key for key, value in d.items()} From 615b76d7005a03fb20e76aa676c4dda7fdcf061d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra=20=C3=96zt=C3=BCrk?= Date: Wed, 28 Oct 2026 19:03:38 +0300 Subject: [PATCH 6/8] Add performance decorator with memory tracking Implement a performance decorator to measure execution time and memory usage. --- Week04/decrators_bugra_ozturk.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Week04/decrators_bugra_ozturk.py diff --git a/Week04/decrators_bugra_ozturk.py b/Week04/decrators_bugra_ozturk.py new file mode 100644 index 000000000..aca3d2030 --- /dev/null +++ b/Week04/decrators_bugra_ozturk.py @@ -0,0 +1,23 @@ +import time +import tracemalloc + + +def performance(func): + def _performance(*args, **kwargs): + tracemalloc.start() + start = time.perf_counter() + result = func(*args, **kwargs) + end = time.perf_counter() + _, peak = tracemalloc.get_traced_memory() + tracemalloc.stop() + + performance.counter += 1 + performance.total_time += end - start + performance.total_mem += peak + return result + return _performance + + +performance.counter = 0 +performance.total_time = 0 +performance.total_mem = 0 From e3742b1f69220109e8c392d197b6095630bd4869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra=20=C3=96zt=C3=BCrk?= Date: Wed, 28 Oct 2026 19:08:21 +0300 Subject: [PATCH 7/8] Delete Week04/decrators_bugra_ozturk.py --- Week04/decrators_bugra_ozturk.py | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 Week04/decrators_bugra_ozturk.py diff --git a/Week04/decrators_bugra_ozturk.py b/Week04/decrators_bugra_ozturk.py deleted file mode 100644 index aca3d2030..000000000 --- a/Week04/decrators_bugra_ozturk.py +++ /dev/null @@ -1,23 +0,0 @@ -import time -import tracemalloc - - -def performance(func): - def _performance(*args, **kwargs): - tracemalloc.start() - start = time.perf_counter() - result = func(*args, **kwargs) - end = time.perf_counter() - _, peak = tracemalloc.get_traced_memory() - tracemalloc.stop() - - performance.counter += 1 - performance.total_time += end - start - performance.total_mem += peak - return result - return _performance - - -performance.counter = 0 -performance.total_time = 0 -performance.total_mem = 0 From d4f4cdd959a24e1c6086f64193f125431a126e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bu=C4=9Fra=20=C3=96zt=C3=BCrk?= Date: Wed, 28 Oct 2026 19:10:19 +0300 Subject: [PATCH 8/8] Add performance decorator with memory and time tracking Implement a performance decorator to measure execution time and memory usage. --- Week04/decorators_bugra_ozturk.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Week04/decorators_bugra_ozturk.py diff --git a/Week04/decorators_bugra_ozturk.py b/Week04/decorators_bugra_ozturk.py new file mode 100644 index 000000000..aca3d2030 --- /dev/null +++ b/Week04/decorators_bugra_ozturk.py @@ -0,0 +1,23 @@ +import time +import tracemalloc + + +def performance(func): + def _performance(*args, **kwargs): + tracemalloc.start() + start = time.perf_counter() + result = func(*args, **kwargs) + end = time.perf_counter() + _, peak = tracemalloc.get_traced_memory() + tracemalloc.stop() + + performance.counter += 1 + performance.total_time += end - start + performance.total_mem += peak + return result + return _performance + + +performance.counter = 0 +performance.total_time = 0 +performance.total_mem = 0