From 24303b47a5ca6e7c8dd082d0f5856c28adb2b85a Mon Sep 17 00:00:00 2001 From: SlainST Date: Sun, 5 Apr 2026 12:03:48 +0300 Subject: [PATCH] Implement pyramid height calculation function Add function to calculate pyramid height based on input number. --- Week03/pyramid_serhat_tufan.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Week03/pyramid_serhat_tufan.py diff --git a/Week03/pyramid_serhat_tufan.py b/Week03/pyramid_serhat_tufan.py new file mode 100644 index 00000000..074df643 --- /dev/null +++ b/Week03/pyramid_serhat_tufan.py @@ -0,0 +1,15 @@ + +def calculate_pyramid_height(number: int) -> int : + height=0 + needed=1 + while number>0: + if number >= needed: + height+=1 + number= number -1*needed + needed+= 1 + else: + print("else awoken") + break + print(f"number is +{number}") + return height +# print(calculate_pyramid_height(100000))