From e522a6c79dfeaa0c8708126a6d35f9b2815fd87f Mon Sep 17 00:00:00 2001 From: protagonist9 Date: Fri, 14 Nov 2025 20:34:20 +0300 Subject: [PATCH 1/2] Week03 homeworks done --- Week03/pyramid_tarik_bozgan.py | 8 ++++++++ Week03/sequences_tarik_bozgan.py | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Week03/pyramid_tarik_bozgan.py create mode 100644 Week03/sequences_tarik_bozgan.py diff --git a/Week03/pyramid_tarik_bozgan.py b/Week03/pyramid_tarik_bozgan.py new file mode 100644 index 0000000..18bd717 --- /dev/null +++ b/Week03/pyramid_tarik_bozgan.py @@ -0,0 +1,8 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + while number_of_blocks >= 0: + height += 1 + number_of_blocks -= height + return height - 1 + +print(calculate_pyramid_height(10)) \ No newline at end of file diff --git a/Week03/sequences_tarik_bozgan.py b/Week03/sequences_tarik_bozgan.py new file mode 100644 index 0000000..1ba0206 --- /dev/null +++ b/Week03/sequences_tarik_bozgan.py @@ -0,0 +1,23 @@ +def remove_duplicates(seq): + result = [] + for item in seq: + if item not in result: + result.append(item) + return result + + +def list_counts(seq): + counts = {} + for item in seq: + if item in counts: + counts[item] += 1 + else: + counts[item] = 1 + return counts + + +def reverse_dict(d): + reversed_dict = {} + for key, value in d.items(): + reversed_dict[value] = key + return reversed_dict \ No newline at end of file From cbdc93516e86d608fa06d2c69c91bbaef6ab57ad Mon Sep 17 00:00:00 2001 From: protagonist9 <156001177+protagonist9@users.noreply.github.com> Date: Fri, 14 Nov 2025 20:35:52 +0300 Subject: [PATCH 2/2] Week03 homeworks done --- Week03/pyramid_tarik_bozgan.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Week03/pyramid_tarik_bozgan.py b/Week03/pyramid_tarik_bozgan.py index 18bd717..9bd324b 100644 --- a/Week03/pyramid_tarik_bozgan.py +++ b/Week03/pyramid_tarik_bozgan.py @@ -4,5 +4,3 @@ def calculate_pyramid_height(number_of_blocks): height += 1 number_of_blocks -= height return height - 1 - -print(calculate_pyramid_height(10)) \ No newline at end of file