Skip to content

Commit 475664a

Browse files
authored
Add function to calculate pyramid height from blocks
1 parent 8b82b00 commit 475664a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎Week03/pyramid_ugur_kurt.py‎

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

0 commit comments

Comments
 (0)