From 3c745e6389482569f923abfe576dbca6febf8921 Mon Sep 17 00:00:00 2001 From: AlisherShalenov Date: Sat, 7 Nov 2026 21:47:00 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_alisher_shalenov.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Week03/pyramid_alisher_shalenov.py diff --git a/Week03/pyramid_alisher_shalenov.py b/Week03/pyramid_alisher_shalenov.py new file mode 100644 index 00000000..d1747ea6 --- /dev/null +++ b/Week03/pyramid_alisher_shalenov.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