We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4014d4f + 20900e2 commit 85ff317Copy full SHA for 85ff317
Week03/pyramid_aygul_ozkeklik.py
@@ -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