From 2d13c9772080fcaadefae25027fad745374f0724 Mon Sep 17 00:00:00 2001 From: ArdaDenizKinikli Date: Mon, 30 Mar 2026 17:04:01 +0300 Subject: [PATCH 1/2] Create: pyramid_ardadeniz_kinikli --- Week03/pyramid_ardadeniz_kinikli.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Week03/pyramid_ardadeniz_kinikli.py diff --git a/Week03/pyramid_ardadeniz_kinikli.py b/Week03/pyramid_ardadeniz_kinikli.py new file mode 100644 index 00000000..f479c22d --- /dev/null +++ b/Week03/pyramid_ardadeniz_kinikli.py @@ -0,0 +1,25 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + blocks_used = 0 + counter = 1 + while blocks_used < number_of_blocks: + blocks_used += counter + if blocks_used == number_of_blocks: + height = counter + break + elif blocks_used > number_of_blocks: + height = counter - 1 + break + counter += 1 + return height + + +if __name__ == "__main__": + print(calculate_pyramid_height(1)) + print(calculate_pyramid_height(2)) + print(calculate_pyramid_height(6)) + print(calculate_pyramid_height(20)) + print(calculate_pyramid_height(100)) + print(calculate_pyramid_height(1000)) + print(calculate_pyramid_height(10000)) + print(calculate_pyramid_height(100000)) \ No newline at end of file From 74891128d95a311b33c7f58ca63fee0bba847543 Mon Sep 17 00:00:00 2001 From: ArdaDenizKinikli Date: Tue, 31 Mar 2026 15:20:38 +0300 Subject: [PATCH 2/2] Remove: Print calls from pyramid_ardadeniz_kinikli --- Week03/pyramid_ardadeniz_kinikli.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Week03/pyramid_ardadeniz_kinikli.py b/Week03/pyramid_ardadeniz_kinikli.py index f479c22d..9e7b4ff1 100644 --- a/Week03/pyramid_ardadeniz_kinikli.py +++ b/Week03/pyramid_ardadeniz_kinikli.py @@ -14,12 +14,3 @@ def calculate_pyramid_height(number_of_blocks): return height -if __name__ == "__main__": - print(calculate_pyramid_height(1)) - print(calculate_pyramid_height(2)) - print(calculate_pyramid_height(6)) - print(calculate_pyramid_height(20)) - print(calculate_pyramid_height(100)) - print(calculate_pyramid_height(1000)) - print(calculate_pyramid_height(10000)) - print(calculate_pyramid_height(100000)) \ No newline at end of file