Skip to content

Commit a4f926e

Browse files
authored
Merge pull request canbula#472 from rukiye-ilhan/patch-3
Create pyramid_rukiye_ilhan.py
2 parents 6eb73e1 + e03fe1b commit a4f926e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Week03/pyramid_rukiye_ilhan.py

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

0 commit comments

Comments
 (0)