Skip to content

Commit f0652b0

Browse files
authored
Add function to calculate pyramid height
1 parent 71f5b39 commit f0652b0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Week03/pyramid_first_last.py

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

0 commit comments

Comments
 (0)