From a152f8d70f4300ed8d9da0fc11e8d31e6586cf3f Mon Sep 17 00:00:00 2001 From: mantuhotep Date: Thu, 12 Mar 2026 13:57:42 +0300 Subject: [PATCH] Add function to calculate pyramid height --- Week03/pyramid_muhammet_topcu.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Week03/pyramid_muhammet_topcu.py diff --git a/Week03/pyramid_muhammet_topcu.py b/Week03/pyramid_muhammet_topcu.py new file mode 100644 index 00000000..a77c98c1 --- /dev/null +++ b/Week03/pyramid_muhammet_topcu.py @@ -0,0 +1,9 @@ +def calculate_pyramid_height(n): + height = 0 + blocks = 0 + + while blocks + height + 1 <= n: + height += 1 + blocks += height + + return height