From 19456d4d5e299e2d4ca74476c6abc4d99db0aee6 Mon Sep 17 00:00:00 2001 From: BugraFiloglu Date: Sun, 1 Nov 2026 21:36:29 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_ilyas_bugra_filoglu.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Week03/pyramid_ilyas_bugra_filoglu.py diff --git a/Week03/pyramid_ilyas_bugra_filoglu.py b/Week03/pyramid_ilyas_bugra_filoglu.py new file mode 100644 index 000000000..6b7188f73 --- /dev/null +++ b/Week03/pyramid_ilyas_bugra_filoglu.py @@ -0,0 +1,8 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + needed_blocks = 1 + while number_of_blocks >= needed_blocks: + number_of_blocks -= needed_blocks + height += 1 + needed_blocks += 1 + return height