From bc4553d58484341a6efd361b2d0e4de3d348873d Mon Sep 17 00:00:00 2001 From: RukiyeTura <124088168+RukiyeTura@users.noreply.github.com> Date: Sat, 2 Nov 2024 16:17:06 +0300 Subject: [PATCH] Create pyramid_rukiye_tura.py --- Week03/pyramid_rukiye_tura.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Week03/pyramid_rukiye_tura.py diff --git a/Week03/pyramid_rukiye_tura.py b/Week03/pyramid_rukiye_tura.py new file mode 100644 index 00000000..840ca016 --- /dev/null +++ b/Week03/pyramid_rukiye_tura.py @@ -0,0 +1,10 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + current_row_blocks = 1 + + while number_of_blocks >= current_row_blocks: + number_of_blocks -= current_row_blocks + height += 1 + current_row_blocks += 1 + + return height