From 52d84b7347ef394dd3e9f6dba132fe5fb24eae70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20Furkan=20Y=C4=B1lmaz?= Date: Tue, 24 Mar 2026 13:51:42 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_mustafafurkan_yilmaz.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Week03/pyramid_mustafafurkan_yilmaz.py diff --git a/Week03/pyramid_mustafafurkan_yilmaz.py b/Week03/pyramid_mustafafurkan_yilmaz.py new file mode 100644 index 00000000..2905219f --- /dev/null +++ b/Week03/pyramid_mustafafurkan_yilmaz.py @@ -0,0 +1,8 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + layer = 1 + while number_of_blocks >= layer: + number_of_blocks -= layer + height += 1 + layer += 1 + return height