From 60d0258bc7f1d0e2cd30ddbc0d917f6ce4a0d6de Mon Sep 17 00:00:00 2001 From: ysnsoytas <163600373+ysnsoytas@users.noreply.github.com> Date: Wed, 7 Jan 2026 19:09:40 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_yasin_soytas.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Week03/pyramid_yasin_soytas.py diff --git a/Week03/pyramid_yasin_soytas.py b/Week03/pyramid_yasin_soytas.py new file mode 100644 index 00000000..7dc8bca5 --- /dev/null +++ b/Week03/pyramid_yasin_soytas.py @@ -0,0 +1,9 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + used_blocks = 0 + + while used_blocks + (height + 1) <= number_of_blocks: + height += 1 + used_blocks += height + + return height