From 3d02a31b4a0ca4f805135a31d6565e0cdaf80364 Mon Sep 17 00:00:00 2001 From: beytullaharslannn <151189674+beytullaharslannn@users.noreply.github.com> Date: Sat, 17 Oct 2026 20:25:46 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_beytullah_arslan.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Week03/pyramid_beytullah_arslan.py diff --git a/Week03/pyramid_beytullah_arslan.py b/Week03/pyramid_beytullah_arslan.py new file mode 100644 index 000000000..d1747ea6d --- /dev/null +++ b/Week03/pyramid_beytullah_arslan.py @@ -0,0 +1,10 @@ +def calculate_pyramid_height(number_of_blocks): + total = 0 + height = 0 + for i in range(1, number_of_blocks + 1): + total += i + if total > number_of_blocks: + break + else: + height = i + return height