Skip to content

Commit 7875ef4

Browse files
authored
Update pyramid_esra_kaya.py
1 parent ec6f664 commit 7875ef4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Week03/pyramid_esra_kaya.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
def calculate_pyramid_height(cube_number):
2-
total_cube = 0
1+
def calculate_pyramid_height(number_of_blocks):
32
height = 0
4-
5-
while total_cube < cube_number:
3+
total_blocks = 0
4+
while total_blocks + height + 1 <= number_of_blocks:
65
height += 1
7-
total_cube += height
8-
if total_cube == cube_number:
9-
return height
6+
total_blocks += height
7+
return height

0 commit comments

Comments
 (0)