Skip to content

Commit ca031d3

Browse files
Week3 Add function to calculate pyramid height from blocks
1 parent 8415c79 commit ca031d3

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎Week03/pyramid_egehan_hatipoglu.py‎

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

0 commit comments

Comments
 (0)