Skip to content

Commit e4fde46

Browse files
author
Seher Arslanbay
committed
pyramid homework week3
1 parent 4356ee9 commit e4fde46

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎Week03/pyramid_seher_arslanbay.py‎

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

0 commit comments

Comments
 (0)