Skip to content

Commit 6b0ce98

Browse files
Add function to calculate pyramid height from blocks
1 parent f71c2d0 commit 6b0ce98

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎Week03/pyramid_bugra_ozturk.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def calculate_pyramid_height(number_of_blocks):
2+
height = 0
3+
used_blocks = 0
4+
while used_blocks + (height + 1) <= number_of_blocks:
5+
height += 1
6+
used_blocks += height
7+
return height

0 commit comments

Comments
 (0)