From 0bd8f353d64a800a0d72ba9211125d6e36040bb9 Mon Sep 17 00:00:00 2001 From: MuhammedSalihYesilay Date: Tue, 28 Oct 2025 15:04:15 +0300 Subject: [PATCH] Add function to calculate pyramid height from blocks --- Week03/pyramid_muhammedsalih_yesilay.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Week03/pyramid_muhammedsalih_yesilay.py diff --git a/Week03/pyramid_muhammedsalih_yesilay.py b/Week03/pyramid_muhammedsalih_yesilay.py new file mode 100644 index 00000000..c8e1518b --- /dev/null +++ b/Week03/pyramid_muhammedsalih_yesilay.py @@ -0,0 +1,12 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + + for i in range(1, number_of_blocks + 1): + if number_of_blocks >= i: + number_of_blocks -= i + height += 1 + else: + break + + #print("Kalan blok sayısı:", number_of_blocks) + return height