diff --git a/Week03/pyramid_muhammet_birge.py b/Week03/pyramid_muhammet_birge.py new file mode 100644 index 00000000..958485f6 --- /dev/null +++ b/Week03/pyramid_muhammet_birge.py @@ -0,0 +1,15 @@ + +def calculate_pyramid_height(number_of_blocks): + height = 0 + used_blocks = 0 + + while True: + required_blocks = height + 1 + + if used_blocks + required_blocks > number_of_blocks: + break + + used_blocks += required_blocks + height += 1 + + return height