Skip to content

Commit 161f3b1

Browse files
Add function to calculate pyramid height
1 parent 71f5b39 commit 161f3b1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Week03/pyramid_buse_demirbas.py

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

0 commit comments

Comments
 (0)