Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Week03/pyramid_dilara_agac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def calculate_pyramid_height(number_of_blocks):
"""
This function calculates the height of a pyramid
that can be built with the given number of blocks.
"""
height = 0
used_blocks = 0

while used_blocks + (height + 1) <= number_of_blocks:
height += 1
used_blocks += height

return height