Skip to content

Commit ca74196

Browse files
authored
Merge pull request #701 from ugur-kurt/patch-2
Add function to calculate pyramid height from blocks
2 parents 127cb27 + c0aa4db commit ca74196

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎Week03/pyramid_ugur_kurt.py‎

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

0 commit comments

Comments
 (0)