From 168fc6b6c90368e702b28497980a0e0be84aeee1 Mon Sep 17 00:00:00 2001 From: Umut <230315070@ogr.cbu.edu.tr> Date: Wed, 7 Oct 2026 19:24:10 +0300 Subject: [PATCH 1/8] W2HW --- Week02/types_umut_turk.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Week02/types_umut_turk.py diff --git a/Week02/types_umut_turk.py b/Week02/types_umut_turk.py new file mode 100644 index 000000000..c3dbf5658 --- /dev/null +++ b/Week02/types_umut_turk.py @@ -0,0 +1,4 @@ +my_int = 1312 +my_float = 1157.25 +my_bool = True +my_complex = 4j+8 \ No newline at end of file From d648e992177636934f4af72677e0957b7d6d01ba Mon Sep 17 00:00:00 2001 From: Umut <230315070@ogr.cbu.edu.tr> Date: Wed, 7 Oct 2026 20:29:48 +0300 Subject: [PATCH 2/8] W3HW --- Week03/pyramid_umut_turk.py | 11 ++++++++++ Week03/sequences.py | 40 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Week03/pyramid_umut_turk.py create mode 100644 Week03/sequences.py diff --git a/Week03/pyramid_umut_turk.py b/Week03/pyramid_umut_turk.py new file mode 100644 index 000000000..69b6f3bca --- /dev/null +++ b/Week03/pyramid_umut_turk.py @@ -0,0 +1,11 @@ +def calculate_pyramid_height(b_num): + a, b = 1, 0 + while b < b_num: + b += a+1 + a += 1 + + + return a-1 + +if __name__ == "__main__": + print(calculate_pyramid_height(15)) \ No newline at end of file diff --git a/Week03/sequences.py b/Week03/sequences.py new file mode 100644 index 000000000..c679adf53 --- /dev/null +++ b/Week03/sequences.py @@ -0,0 +1,40 @@ +def remove_duplicates(a_list): + my_list = a_list[:] + x = 1 + for i in my_list: + for j in my_list[x:]: + if i == j: + my_list.remove(i) + x -=1 + break + x +=1 + + return my_list +def list_counts(a_list): + my_list = a_list[:] + a = remove_duplicates(my_list) + my_dict = dict.fromkeys(a) + for i in a: + x = 0 + for j in a_list: + if i == j: + x += 1 + my_dict[i] = x + + return my_dict +def reverse_dict(a_dict): + my_dict = {} + a_list = list(a_dict) + b_list = list(a_dict.values()) + x = 0 + while x < len(a_list): + print(1) + my_dict[b_list[x]] = a_list[x] + x += 1 + + return my_dict + +if __name__ == "__main__": + print(remove_duplicates([1,5,4,4,4,6,41,54,54,41,6])) + print(list_counts([1,5,5,4,4,4,6,6,6,41,41,41,41,41,54,54,54,54,54,54,54,54,41,6])) + print(reverse_dict(list_counts([1,5,5,4,4,4,6,6,6,41,41,41,41,41,54,54,54,54,54,54,54,54,41,6]))) \ No newline at end of file From 1ec27195af099447faaf77626d69b51d98622d2a Mon Sep 17 00:00:00 2001 From: Umut <230315070@ogr.cbu.edu.tr> Date: Wed, 7 Oct 2026 21:15:06 +0300 Subject: [PATCH 3/8] W3HWV2 --- Week03/sequences.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Week03/sequences.py b/Week03/sequences.py index c679adf53..ea98b8986 100644 --- a/Week03/sequences.py +++ b/Week03/sequences.py @@ -1,14 +1,13 @@ def remove_duplicates(a_list): my_list = a_list[:] - x = 1 - for i in my_list: - for j in my_list[x:]: - if i == j: - my_list.remove(i) - x -=1 - break - x +=1 - + for i in a_list: + x = True + for j, k in enumerate(my_list): + if i == k: + if x: + x = False + else: + del my_list[j] return my_list def list_counts(a_list): my_list = a_list[:] @@ -35,6 +34,6 @@ def reverse_dict(a_dict): return my_dict if __name__ == "__main__": - print(remove_duplicates([1,5,4,4,4,6,41,54,54,41,6])) + print(remove_duplicates([1,5,5,4,4,4,6,6,6,41,41,41,41,41,41,54,54,54,54,54,54,54,54,41,6])) print(list_counts([1,5,5,4,4,4,6,6,6,41,41,41,41,41,54,54,54,54,54,54,54,54,41,6])) print(reverse_dict(list_counts([1,5,5,4,4,4,6,6,6,41,41,41,41,41,54,54,54,54,54,54,54,54,41,6]))) \ No newline at end of file From ca2b5fa61c64321a92fda6fad0edd3985f7064c1 Mon Sep 17 00:00:00 2001 From: Umut <230315070@ogr.cbu.edu.tr> Date: Wed, 7 Oct 2026 21:16:40 +0300 Subject: [PATCH 4/8] W3HWV3 --- Week03/{sequences.py => sequences_umut_turk.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Week03/{sequences.py => sequences_umut_turk.py} (100%) diff --git a/Week03/sequences.py b/Week03/sequences_umut_turk.py similarity index 100% rename from Week03/sequences.py rename to Week03/sequences_umut_turk.py From 3fe9bc892a6a84f35d580466bc54245752aad4e4 Mon Sep 17 00:00:00 2001 From: Umut <230315070@ogr.cbu.edu.tr> Date: Tue, 20 Oct 2026 11:39:26 +0300 Subject: [PATCH 5/8] W5HWV4 --- Week04/decorators_umut_turk.py | 0 Week04/functions_umut_turk.py | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Week04/decorators_umut_turk.py create mode 100644 Week04/functions_umut_turk.py diff --git a/Week04/decorators_umut_turk.py b/Week04/decorators_umut_turk.py new file mode 100644 index 000000000..e69de29bb diff --git a/Week04/functions_umut_turk.py b/Week04/functions_umut_turk.py new file mode 100644 index 000000000..822b67814 --- /dev/null +++ b/Week04/functions_umut_turk.py @@ -0,0 +1,25 @@ +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: + """_summary_ + + Args: + x (int, optional): _description_. Defaults to 0. positional only + y (int, optional): _description_. Defaults to 0. positional only + a (int, optional): _description_. Defaults to 1. positional or keyword + b (int, optional): _description_. Defaults to 1. positional or keyword + c (int, optional): _description_. Defaults to 1. keyword only + + Returns: + float: _description_ + x**a + y**b / c + """ + return (x**a + y**b) / c + +def fn_w_counter(): + if not hasattr(fn_w_counter, "counter"): + fn_w_counter.counter = 0 + fn_w_counter.counter += 1 + return (fn_w_counter.counter, {fn_w_counter.__module__: fn_w_counter.counter}) +if __name__ == "__main__": + print(fn_w_counter()) \ No newline at end of file From 8716de6ec2f3d6b3f086435d29a97bdd51af53b5 Mon Sep 17 00:00:00 2001 From: Umut <230315070@ogr.cbu.edu.tr> Date: Tue, 20 Oct 2026 11:42:22 +0300 Subject: [PATCH 6/8] W5HWV4 --- Week04/functions_umut_turk.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Week04/functions_umut_turk.py b/Week04/functions_umut_turk.py index 822b67814..cdf187452 100644 --- a/Week04/functions_umut_turk.py +++ b/Week04/functions_umut_turk.py @@ -1,18 +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: - """_summary_ + """Calculate custom polynomial equation result. - Args: - x (int, optional): _description_. Defaults to 0. positional only - y (int, optional): _description_. Defaults to 0. positional only - a (int, optional): _description_. Defaults to 1. positional or keyword - b (int, optional): _description_. Defaults to 1. positional or keyword - c (int, optional): _description_. Defaults to 1. keyword only + Calculates :math:`\\frac{x^a + y^b}{c}`. - Returns: - float: _description_ - x**a + y**b / c + :param x: Positional-only x value, defaults to 0 + :type x: int, optional + :param y: Positional-only y value, defaults to 0 + :type y: int, optional + :param a: Positional-or-keyword exponent for x, defaults to 1 + :type a: int, optional + :param b: Positional-or-keyword exponent for y, defaults to 1 + :type b: int, optional + :param c: Keyword-only denominator, defaults to 1 + :type c: int, optional + :return: Result of (x**a + y**b) / c + :rtype: float """ return (x**a + y**b) / c From 3b418c54402e71ef1a2a24067af6a3a390052519 Mon Sep 17 00:00:00 2001 From: Umut <230315070@ogr.cbu.edu.tr> Date: Tue, 20 Oct 2026 11:46:59 +0300 Subject: [PATCH 7/8] W5HWV4 --- Week04/functions_umut_turk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week04/functions_umut_turk.py b/Week04/functions_umut_turk.py index cdf187452..8fc432c8b 100644 --- a/Week04/functions_umut_turk.py +++ b/Week04/functions_umut_turk.py @@ -20,7 +20,7 @@ def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int """ return (x**a + y**b) / c -def fn_w_counter(): +def fn_w_counter() -> tuple[str, dict]: if not hasattr(fn_w_counter, "counter"): fn_w_counter.counter = 0 fn_w_counter.counter += 1 From 20b779902a39dddc3e68000ac6daf4b51f011797 Mon Sep 17 00:00:00 2001 From: Umut <230315070@ogr.cbu.edu.tr> Date: Tue, 20 Oct 2026 11:49:17 +0300 Subject: [PATCH 8/8] W5HWV4 --- Week04/functions_umut_turk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week04/functions_umut_turk.py b/Week04/functions_umut_turk.py index 8fc432c8b..fb9bf2bf5 100644 --- a/Week04/functions_umut_turk.py +++ b/Week04/functions_umut_turk.py @@ -20,7 +20,7 @@ def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int """ return (x**a + y**b) / c -def fn_w_counter() -> tuple[str, dict]: +def fn_w_counter() -> (int, dict[str, int]): if not hasattr(fn_w_counter, "counter"): fn_w_counter.counter = 0 fn_w_counter.counter += 1