From 0d3606777ee6a798108ac40062a4fcac78e887f8 Mon Sep 17 00:00:00 2001 From: Hilmi <163791964+Spohey@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:04:33 +0300 Subject: [PATCH 1/2] Add files via upload --- "Week03/pyramid_hilmi_ayd\304\261n.py" | 16 ++++++++++++++++ Week03/sequences_hilmi_aydin.py | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 "Week03/pyramid_hilmi_ayd\304\261n.py" create mode 100644 Week03/sequences_hilmi_aydin.py diff --git "a/Week03/pyramid_hilmi_ayd\304\261n.py" "b/Week03/pyramid_hilmi_ayd\304\261n.py" new file mode 100644 index 00000000..47302de5 --- /dev/null +++ "b/Week03/pyramid_hilmi_ayd\304\261n.py" @@ -0,0 +1,16 @@ +def calculate_pyramid_height(number_of_blocks): + # Initialize the height of the pyramid + height = 0 + # Blocks required for the current layer + layer_blocks = 1 + + # Continue building layers as long as there are enough blocks + while number_of_blocks >= layer_blocks: + # Subtract used blocks from the total + number_of_blocks -= layer_blocks + # Increase pyramid height by 1 + height += 1 + # Next layer needs one more block + layer_blocks += 1 + + return height \ No newline at end of file diff --git a/Week03/sequences_hilmi_aydin.py b/Week03/sequences_hilmi_aydin.py new file mode 100644 index 00000000..2cbd3265 --- /dev/null +++ b/Week03/sequences_hilmi_aydin.py @@ -0,0 +1,23 @@ +def remove_duplicates(seq: list) -> list: + """ + This function removes duplicates from a list. + """ + # Convert list to dictionary to remove duplicates, then back to list while preserving order + return list(dict.fromkeys(seq)) + +def list_counts(seq: list) -> dict: + """ + This function counts the number of occurrences of each item in a list. + """ + counts = {} + for item in seq: + # If item exists, increment its count. Otherwise, default to 0 and add 1 + 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. + """ + # Swap keys and values using dictionary comprehension + return {value: key for key, value in d.items()} \ No newline at end of file From 7f620d73913e068797890be2708cb19babc7f76c Mon Sep 17 00:00:00 2001 From: Hilmi <163791964+Spohey@users.noreply.github.com> Date: Thu, 5 Nov 2026 17:08:31 +0300 Subject: [PATCH 2/2] =?UTF-8?q?Rename=20pyramid=5Fhilmi=5Fayd=C4=B1n.py=20?= =?UTF-8?q?to=20pyramid=5Fhilmi=5Faydin.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pyramid_hilmi_aydin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename "Week03/pyramid_hilmi_ayd\304\261n.py" => Week03/pyramid_hilmi_aydin.py (93%) diff --git "a/Week03/pyramid_hilmi_ayd\304\261n.py" b/Week03/pyramid_hilmi_aydin.py similarity index 93% rename from "Week03/pyramid_hilmi_ayd\304\261n.py" rename to Week03/pyramid_hilmi_aydin.py index 47302de5..c1c3a2f1 100644 --- "a/Week03/pyramid_hilmi_ayd\304\261n.py" +++ b/Week03/pyramid_hilmi_aydin.py @@ -13,4 +13,4 @@ def calculate_pyramid_height(number_of_blocks): # Next layer needs one more block layer_blocks += 1 - return height \ No newline at end of file + return height