Skip to content

Commit 9d2da3a

Browse files
authored
Merge pull request #970 from ilknuralpnar/patch-1
Add function to calculate pyramid height from blocks
2 parents 5fe4f3b + a47f49f commit 9d2da3a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎Week03/pyramid_ilknur_alpnar.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+
while number_of_blocks > 0:
4+
height += 1
5+
number_of_blocks -= height
6+
7+
if number_of_blocks < 0:
8+
height -= 1
9+
return height

0 commit comments

Comments
 (0)