Skip to content

Commit 2761026

Browse files
authored
Merge pull request #645 from berkinyl/patch-2
Create pyramid_berkin_yildirim.py
2 parents 7d15296 + 0cbcd4b commit 2761026

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Week03/pyramid_berkin_yildirim.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def calculate_pyramid_height(blocks):
2+
height = 0
3+
4+
for level in range(1, blocks + 1):
5+
if blocks >= level:
6+
blocks -= level
7+
height += 1
8+
else:
9+
break
10+
return height

0 commit comments

Comments
 (0)