From 32291535c73b0b890b560fc9443f92e31be63f02 Mon Sep 17 00:00:00 2001 From: ErtugrulKGIT Date: Mon, 30 Mar 2026 18:41:45 +0300 Subject: [PATCH 1/5] =?UTF-8?q?Add=20student=20information=20for=20Ertu?= =?UTF-8?q?=C4=9Frul=20K=C3=B6se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Week01/info_ertugrul_kose.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Week01/info_ertugrul_kose.py diff --git a/Week01/info_ertugrul_kose.py b/Week01/info_ertugrul_kose.py new file mode 100644 index 00000000..301759a2 --- /dev/null +++ b/Week01/info_ertugrul_kose.py @@ -0,0 +1,2 @@ +student_id = "210316038" +full_name = "Ertuğrul Köse" From b650ff9350a71b4565f55b0b8bc190e9d776e903 Mon Sep 17 00:00:00 2001 From: ErtugrulKGIT Date: Tue, 31 Mar 2026 03:15:40 +0300 Subject: [PATCH 2/5] Add variables of different types in types_ertugrul_kose.py --- Week02/types_ertugrul_kose.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Week02/types_ertugrul_kose.py diff --git a/Week02/types_ertugrul_kose.py b/Week02/types_ertugrul_kose.py new file mode 100644 index 00000000..cf628a8f --- /dev/null +++ b/Week02/types_ertugrul_kose.py @@ -0,0 +1,4 @@ +my_int = 9 +my_float = 11.4 +my_bool = True +my_complex = 9j From 3ade409bdf93cd499d2660cfc22c7be10060d9ee Mon Sep 17 00:00:00 2001 From: ErtugrulKGIT Date: Tue, 31 Mar 2026 03:22:41 +0300 Subject: [PATCH 3/5] Create pyramid_ertugrul_kose.py --- Week03/pyramid_ertugrul_kose.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Week03/pyramid_ertugrul_kose.py diff --git a/Week03/pyramid_ertugrul_kose.py b/Week03/pyramid_ertugrul_kose.py new file mode 100644 index 00000000..83d7da7d --- /dev/null +++ b/Week03/pyramid_ertugrul_kose.py @@ -0,0 +1,6 @@ +def calculate_pyramid_height(blocks): + h = 0 + while blocks > h: + h += 1 + blocks -= h + return h From 257ae08b2fdad1ef204923165c8001326cc4b728 Mon Sep 17 00:00:00 2001 From: ErtugrulKGIT Date: Tue, 31 Mar 2026 03:26:11 +0300 Subject: [PATCH 4/5] Implement utility functions for list and dict operations Added functions to remove duplicates from a list, count occurrences of items, and reverse a dictionary. --- Week03/sequences_ertugrul_kose.py | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Week03/sequences_ertugrul_kose.py diff --git a/Week03/sequences_ertugrul_kose.py b/Week03/sequences_ertugrul_kose.py new file mode 100644 index 00000000..c056a0d3 --- /dev/null +++ b/Week03/sequences_ertugrul_kose.py @@ -0,0 +1,34 @@ +def remove_duplicates(seq: list) -> list: + """ + This function removes duplicates from a list. + """ + unique = [] + for x in seq: + if x not in unique: + unique.append(x) + return unique + + +def list_counts(seq: list) -> dict: + """ + This function counts the number of + occurrences of each item in a list. + """ + result = {} + for x in seq: + if x in result: + result[x] += 1 + else: + result[x] = 1 + return result + + +def reverse_dict(d: dict) -> dict: + """ + This function reverses the keys + and values of a dictionary + """ + rev = {} + for k, v in d.items(): + rev[v] = k + return rev From 69b191407b061fa0755859e4830c2153c81956da Mon Sep 17 00:00:00 2001 From: ErtugrulKGIT Date: Tue, 31 Mar 2026 03:30:37 +0300 Subject: [PATCH 5/5] Implement performance decorator for function metrics Added a performance decorator to track call count, execution time, and memory usage. --- Week04/decorators_ertugrul_kose.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Week04/decorators_ertugrul_kose.py diff --git a/Week04/decorators_ertugrul_kose.py b/Week04/decorators_ertugrul_kose.py new file mode 100644 index 00000000..4d49d388 --- /dev/null +++ b/Week04/decorators_ertugrul_kose.py @@ -0,0 +1,30 @@ +import tracemalloc as tm +from time import time as current_time + + +def performance(func): + """ + Decorator that gathers call count, execution time and memory usage. + """ + + performance.count = 0 + performance.time_total = 0.0 + performance.mem_total = 0.0 + + def wrapper(*args, **kwargs): + tm.start() + + start = current_time() + result = func(*args, **kwargs) + end = current_time() + + mem_now, mem_peak = tm.get_traced_memory() + tm.stop() + + performance.count += 1 + performance.time_total += (end - start) + performance.mem_total += mem_peak + + return result + + return wrapper