From 73c774a5294ad88adf0f22b477b068800a02b88e Mon Sep 17 00:00:00 2001 From: dilek <128893136+dilekk1@users.noreply.github.com> Date: Sat, 2 Nov 2024 15:16:34 +0300 Subject: [PATCH] Create pyramid_dilek_celebi.py --- Week03/pyramid_dilek_celebi.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Week03/pyramid_dilek_celebi.py diff --git a/Week03/pyramid_dilek_celebi.py b/Week03/pyramid_dilek_celebi.py new file mode 100644 index 00000000..938ea6ad --- /dev/null +++ b/Week03/pyramid_dilek_celebi.py @@ -0,0 +1,9 @@ +def calculate_pyramid_height(number_of_blocks): + current_height = 0 + blocks_used = 0 + + while blocks_used + current_height + 1 <= number_of_blocks: + current_height += 1 + blocks_used += current_height + + return current_height