Skip to content

Commit 85ff317

Browse files
authored
Merge pull request #977 from aygulozlem45-web/patch-7
Create pyramid_aygul_ozkeklik.py
2 parents 4014d4f + 20900e2 commit 85ff317

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Week03/pyramid_aygul_ozkeklik.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def calculate_pyramid_height(number_of_blocks):
2+
height = 0
3+
total_blocks = 0
4+
5+
while total_blocks + height < number_of_blocks:
6+
height += 1
7+
total_blocks = (height * (height + 1))//2
8+
9+
return height
10+
11+
print(calculate_pyramid_height(10))
12+
print(calculate_pyramid_height(28))
13+
print(calculate_pyramid_height(55))

0 commit comments

Comments
 (0)