From 456f6f864dbd131c1fa9ad597268499687dde1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fevzi=20Ba=C4=9Fr=C4=B1a=C3=A7=C4=B1k?= <124450541+fevzibagriacik@users.noreply.github.com> Date: Tue, 4 Nov 2025 14:32:49 +0300 Subject: [PATCH 1/2] Create pyramid_fevzi_bagriacik.py --- Week03/pyramid_fevzi_bagriacik.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Week03/pyramid_fevzi_bagriacik.py diff --git a/Week03/pyramid_fevzi_bagriacik.py b/Week03/pyramid_fevzi_bagriacik.py new file mode 100644 index 00000000..7e0e8573 --- /dev/null +++ b/Week03/pyramid_fevzi_bagriacik.py @@ -0,0 +1,15 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + total = 0 + + for i in range(1,number_of_blocks+2,1): + + total += i + + if(number_of_blocks <= total): + height = i + break + + + + return height From eed1f0ed20886f0d2c409be68508685d9bf4c665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fevzi=20Ba=C4=9Fr=C4=B1a=C3=A7=C4=B1k?= <124450541+fevzibagriacik@users.noreply.github.com> Date: Tue, 4 Nov 2025 14:40:02 +0300 Subject: [PATCH 2/2] Update pyramid_fevzi_bagriacik.py --- Week03/pyramid_fevzi_bagriacik.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Week03/pyramid_fevzi_bagriacik.py b/Week03/pyramid_fevzi_bagriacik.py index 7e0e8573..baba4150 100644 --- a/Week03/pyramid_fevzi_bagriacik.py +++ b/Week03/pyramid_fevzi_bagriacik.py @@ -6,9 +6,12 @@ def calculate_pyramid_height(number_of_blocks): total += i - if(number_of_blocks <= total): + if number_of_blocks == total: height = i break + elif number_of_blocks < total: + height = i - 1 + break