From 28675f08c8807ec8bd339f9b1ea15b45edfc3653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BA=C5=9EAK=20KO=C3=87AN?= <159764779+mimo-o@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:13:23 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_basak_kocan.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Week03/pyramid_basak_kocan.py diff --git a/Week03/pyramid_basak_kocan.py b/Week03/pyramid_basak_kocan.py new file mode 100644 index 00000000..fd9b52bf --- /dev/null +++ b/Week03/pyramid_basak_kocan.py @@ -0,0 +1,9 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + count = 1 + while (number_of_blocks>=1): + height += 1 + count += 1 + for i in range(0, count): + number_of_blocks -= 1 + return height