From 53726e85b772bcc813e53ef912cd6906b8ac5212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Recep=20G=C3=B6ktu=C4=9F=20Avc=C4=B1?= Date: Wed, 18 Nov 2026 21:03:12 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_recep_goktug_avci.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Week03/pyramid_recep_goktug_avci.py diff --git a/Week03/pyramid_recep_goktug_avci.py b/Week03/pyramid_recep_goktug_avci.py new file mode 100644 index 00000000..1d4f3ff4 --- /dev/null +++ b/Week03/pyramid_recep_goktug_avci.py @@ -0,0 +1,8 @@ +def calculate_pyramid_height(number_of_blocks: int) -> int: + height = 0 # Güncel height + needed_blocks = 1 # o anki katmanda gereken blok sayısı + while number_of_blocks >= needed_blocks: + number_of_blocks -= needed_blocks + height += 1 + needed_blocks += 1 + return height