From 5dbb3024c68873a5926112f141f3c8aa7dbb34cd Mon Sep 17 00:00:00 2001 From: UmuTurk230315070 <230315070@ogr.cbu.edu.tr> Date: Tue, 7 Apr 2026 21:02:59 +0300 Subject: [PATCH 1/8] Add files via upload --- Week03/sequences_umut_turk.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Week03/sequences_umut_turk.py diff --git a/Week03/sequences_umut_turk.py b/Week03/sequences_umut_turk.py new file mode 100644 index 00000000..c16d0f3e --- /dev/null +++ b/Week03/sequences_umut_turk.py @@ -0,0 +1,24 @@ +def remove_duplicates(argList: list) : + for i in argList: + while argList.count(i) > 1: + argList.remove(i) + return argList +def list_counts(argList: list): + retDict = {} + for i in argList: + if i in retDict: + retDict[i] += 1 + else: + retDict[i] = 1 + return retDict +def reverse_dict(argDict: dict): + retDict = {} + for i,j in argDict.items(): + retDict[j]=i + return retDict + + + + + + From b6569a65c84b673c4b1cdebbaa4c724ea4e5c54e Mon Sep 17 00:00:00 2001 From: UmuTurk230315070 <230315070@ogr.cbu.edu.tr> Date: Tue, 7 Apr 2026 22:15:23 +0300 Subject: [PATCH 2/8] Add files via upload --- Week04/functions_umut_turk.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Week04/functions_umut_turk.py diff --git a/Week04/functions_umut_turk.py b/Week04/functions_umut_turk.py new file mode 100644 index 00000000..ffe4fc58 --- /dev/null +++ b/Week04/functions_umut_turk.py @@ -0,0 +1,22 @@ +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"): + setattr(fn_w_counter,"count",1) + setattr(fn_w_counter,"dict",{(str)(__name__) : fn_w_counter.count} ) + else: + fn_w_counter.count +=1 + fn_w_counter.dict[(__name__)] = fn_w_counter.count + return fn_w_counter.count, fn_w_counter.dict \ No newline at end of file From ccd041d35ebe3bd2b7e8461ba73c66984f9e7630 Mon Sep 17 00:00:00 2001 From: UmuTurk230315070 <230315070@ogr.cbu.edu.tr> Date: Tue, 7 Apr 2026 22:17:59 +0300 Subject: [PATCH 3/8] Refactor custom_equation to use keyword-only argument --- Week04/functions_umut_turk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week04/functions_umut_turk.py b/Week04/functions_umut_turk.py index ffe4fc58..60f87249 100644 --- a/Week04/functions_umut_turk.py +++ b/Week04/functions_umut_turk.py @@ -1,6 +1,6 @@ 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: +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. @@ -19,4 +19,4 @@ def fn_w_counter() -> (int, dict[str, int]): else: fn_w_counter.count +=1 fn_w_counter.dict[(__name__)] = fn_w_counter.count - return fn_w_counter.count, fn_w_counter.dict \ No newline at end of file + return fn_w_counter.count, fn_w_counter.dict From 406fa13aebc5a525cc690933a5794a0b0f45f0a3 Mon Sep 17 00:00:00 2001 From: UmuTurk230315070 <230315070@ogr.cbu.edu.tr> Date: Tue, 7 Apr 2026 22:42:05 +0300 Subject: [PATCH 4/8] Add files via upload --- Week04/decorators_umut_turk.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Week04/decorators_umut_turk.py diff --git a/Week04/decorators_umut_turk.py b/Week04/decorators_umut_turk.py new file mode 100644 index 00000000..81105979 --- /dev/null +++ b/Week04/decorators_umut_turk.py @@ -0,0 +1,22 @@ +import time +import tracemalloc +def performance(fn): + if not hasattr(performance,"counter"): + setattr(performance,"counter",0) + setattr(performance,"total_time",0) + setattr(performance,"total_mem",0) + def _wrapper(*args,**kwargs): + tracemalloc.start() + startT = time.perf_counter() + result = fn() + endT = time.perf_counter() + timeT = endT - startT + n, high = tracemalloc.get_traced_memory() + tracemalloc.stop() + performance.total_time += timeT + performance.counter += 1 + performance.total_mem += high + return result + return _wrapper() + + \ No newline at end of file From a265e0f3c8f88ead0a71352add2f7533f0256a8c Mon Sep 17 00:00:00 2001 From: UmuTurk230315070 <230315070@ogr.cbu.edu.tr> Date: Tue, 7 Apr 2026 22:49:07 +0300 Subject: [PATCH 5/8] Fix performance decorator to accept function arguments --- Week04/decorators_umut_turk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week04/decorators_umut_turk.py b/Week04/decorators_umut_turk.py index 81105979..0a7fd9c3 100644 --- a/Week04/decorators_umut_turk.py +++ b/Week04/decorators_umut_turk.py @@ -8,7 +8,7 @@ def performance(fn): def _wrapper(*args,**kwargs): tracemalloc.start() startT = time.perf_counter() - result = fn() + result = fn(*args,**kwargs) endT = time.perf_counter() timeT = endT - startT n, high = tracemalloc.get_traced_memory() @@ -19,4 +19,4 @@ def _wrapper(*args,**kwargs): return result return _wrapper() - \ No newline at end of file + From 588011890c76c13a39d051b8dfc02243453c9025 Mon Sep 17 00:00:00 2001 From: UmuTurk230315070 <230315070@ogr.cbu.edu.tr> Date: Tue, 7 Apr 2026 22:54:44 +0300 Subject: [PATCH 6/8] Fix wrapper function name in performance decorator --- Week04/decorators_umut_turk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week04/decorators_umut_turk.py b/Week04/decorators_umut_turk.py index 0a7fd9c3..c8443d28 100644 --- a/Week04/decorators_umut_turk.py +++ b/Week04/decorators_umut_turk.py @@ -5,7 +5,7 @@ def performance(fn): setattr(performance,"counter",0) setattr(performance,"total_time",0) setattr(performance,"total_mem",0) - def _wrapper(*args,**kwargs): + def wrapper(*args,**kwargs): tracemalloc.start() startT = time.perf_counter() result = fn(*args,**kwargs) @@ -17,6 +17,6 @@ def _wrapper(*args,**kwargs): performance.counter += 1 performance.total_mem += high return result - return _wrapper() + return wrapper() From 6afeab18e11b51673f4a81543c6fe36cbfa4a4d1 Mon Sep 17 00:00:00 2001 From: UmuTurk230315070 <230315070@ogr.cbu.edu.tr> Date: Tue, 7 Apr 2026 22:58:36 +0300 Subject: [PATCH 7/8] Update decorators_umut_turk.py --- Week04/decorators_umut_turk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week04/decorators_umut_turk.py b/Week04/decorators_umut_turk.py index c8443d28..b0407ed9 100644 --- a/Week04/decorators_umut_turk.py +++ b/Week04/decorators_umut_turk.py @@ -17,6 +17,6 @@ def wrapper(*args,**kwargs): performance.counter += 1 performance.total_mem += high return result - return wrapper() + return wrapper From 69951cf66a9385beafff94737caade6417c7f7bf Mon Sep 17 00:00:00 2001 From: UmuTurk230315070 <230315070@ogr.cbu.edu.tr> Date: Tue, 7 Apr 2026 23:05:20 +0300 Subject: [PATCH 8/8] Add files via upload --- Week05/awaitme_umut_turk.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Week05/awaitme_umut_turk.py diff --git a/Week05/awaitme_umut_turk.py b/Week05/awaitme_umut_turk.py new file mode 100644 index 00000000..09333990 --- /dev/null +++ b/Week05/awaitme_umut_turk.py @@ -0,0 +1,7 @@ +import asyncio + +def awaitme(fn): + async def wrapper(*args,**kwargs): + result = fn(*args,**kwargs) + return result + return wrapper \ No newline at end of file