diff --git a/Week03/pyramid_yusuf_baris.py b/Week03/pyramid_yusuf_baris.py new file mode 100644 index 000000000..e372fe543 --- /dev/null +++ b/Week03/pyramid_yusuf_baris.py @@ -0,0 +1,10 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + blocks_used = 0 + while blocks_used + (height + 1) ** 2 <= number_of_blocks: + height += 1 + blocks_used += height ** 2 + return height + + +print(calculate_pyramid_height(14))