From f28c21309633552b024f04241814d439d2a5b6f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elif=20Yalva=C3=A7?= <59252046+elifyalvac@users.noreply.github.com> Date: Tue, 18 Nov 2025 02:50:27 +0300 Subject: [PATCH] Add function to calculate pyramid height --- Week03/pyramid_elif_yalvac.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Week03/pyramid_elif_yalvac.py diff --git a/Week03/pyramid_elif_yalvac.py b/Week03/pyramid_elif_yalvac.py new file mode 100644 index 00000000..ac816c41 --- /dev/null +++ b/Week03/pyramid_elif_yalvac.py @@ -0,0 +1,10 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + required_blocks = 1 + + while number_of_blocks >= required_blocks: + number_of_blocks -= required_blocks + height += 1 + required_blocks += 1 + + return height