Skip to content

Commit eab1397

Browse files
authored
Create pyramid_emin_badur.py
1 parent f657070 commit eab1397

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Week03/pyramid_emin_badur.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def calculate_pyramid_height(number_of_blocks):
2+
height = 1
3+
4+
if number_of_blocks <= 0 :
5+
raise ValueError("Number of blocks must be positive ")
6+
7+
while number_of_blocks > height + 1 :
8+
height += 1
9+
number_of_blocks -= height
10+
11+
return height

0 commit comments

Comments
 (0)