From c965364519dff39d135ae6efa62e5a31d7d864cd Mon Sep 17 00:00:00 2001 From: yarenzgr Date: Tue, 2 Dec 2025 10:27:45 +0300 Subject: [PATCH] Add function to calculate pyramid height --- Week03/pyramid_yaren_ozgur.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Week03/pyramid_yaren_ozgur.py diff --git a/Week03/pyramid_yaren_ozgur.py b/Week03/pyramid_yaren_ozgur.py new file mode 100644 index 00000000..cd720b99 --- /dev/null +++ b/Week03/pyramid_yaren_ozgur.py @@ -0,0 +1,7 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + used = 0 + while used + (height + 1) <= number_of_blocks: + height += 1 + used += height + return height