diff --git a/Week03/pyramid_turhan_gunduzoglu.py b/Week03/pyramid_turhan_gunduzoglu.py new file mode 100644 index 00000000..fdd58c46 --- /dev/null +++ b/Week03/pyramid_turhan_gunduzoglu.py @@ -0,0 +1,9 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + used_blocks = 0 + + while used_blocks + (height + 1) <= number_of_blocks: + height += 1 + used_blocks += height + + return height