From 963719fba784922e5ba025f2cd65afec3593320c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gamze=20K=C4=B1l=C4=B1n=C3=A7?= <149265010+gamzeklnc@users.noreply.github.com> Date: Mon, 5 Jan 2026 13:35:09 +0300 Subject: [PATCH] Add function to calculate pyramid height --- Week03/pyramid_gamze_kilinc.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Week03/pyramid_gamze_kilinc.py diff --git a/Week03/pyramid_gamze_kilinc.py b/Week03/pyramid_gamze_kilinc.py new file mode 100644 index 00000000..7dc8bca5 --- /dev/null +++ b/Week03/pyramid_gamze_kilinc.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