From 1fb542a5459cefc31db9cb496a156571616bd4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0brahim=20As?= <148447898+zteplez@users.noreply.github.com> Date: Tue, 31 Mar 2026 21:40:16 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_ibrahim_as.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Week03/pyramid_ibrahim_as.py diff --git a/Week03/pyramid_ibrahim_as.py b/Week03/pyramid_ibrahim_as.py new file mode 100644 index 00000000..832a02a8 --- /dev/null +++ b/Week03/pyramid_ibrahim_as.py @@ -0,0 +1,10 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + n = 0 + while True: + blocks_needed = (n * (n + 1)) // 2 + if blocks_needed > number_of_blocks: + break + height = n + n += 1 + return height