From c4dc1ead20708857254d3fb5680a7fb71e47ca64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleyna=20G=C3=BCltekin?= Date: Thu, 15 Oct 2026 14:36:31 +0300 Subject: [PATCH 1/2] Add function to calculate pyramid height from blocks --- Week03/pyramid_aleyna_gultekin.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Week03/pyramid_aleyna_gultekin.py diff --git a/Week03/pyramid_aleyna_gultekin.py b/Week03/pyramid_aleyna_gultekin.py new file mode 100644 index 000000000..7322de282 --- /dev/null +++ b/Week03/pyramid_aleyna_gultekin.py @@ -0,0 +1,6 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + while number_of_blocks >= height + 1: + height += 1 + number_of_blocks -= height + return height From 2039f3a51dddbe0a2592f35817c73a2dd87b2d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleyna=20G=C3=BCltekin?= Date: Thu, 15 Oct 2026 14:39:26 +0300 Subject: [PATCH 2/2] Add utility functions for list and dict operations Implemented three utility functions: remove_duplicates, list_counts, and reverse_dict. --- Week03/sequences_aleyna_gultekin.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Week03/sequences_aleyna_gultekin.py diff --git a/Week03/sequences_aleyna_gultekin.py b/Week03/sequences_aleyna_gultekin.py new file mode 100644 index 000000000..ae31fb733 --- /dev/null +++ b/Week03/sequences_aleyna_gultekin.py @@ -0,0 +1,26 @@ +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()}