Skip to content

Commit e99e79f

Browse files
Create pyramid_hatice_akgul.py
1 parent 71f5b39 commit e99e79f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Week03/pyramid_hatice_akgul.py

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

0 commit comments

Comments
 (0)