Skip to content

Commit a233c10

Browse files
authored
Add pyramid height calculation based on cube number
1 parent 669cc4e commit a233c10

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Week03/pyramid_tufan_sengel.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
input_Cube_number = int(input("number of cubes : "))
2+
3+
def calculate_pyramid_height(number_of_blocks):
4+
piramit_cube_height = 1
5+
cube_number_of_piramit = 0
6+
7+
while True:
8+
if cube_number_of_piramit > number_of_blocks:
9+
break
10+
cube_number_of_piramit += piramit_cube_height
11+
piramit_cube_height += 1
12+
13+
piramit_cube_height -= 2
14+
print("the height of the piramit is : ", piramit_cube_height)
15+
return piramit_cube_height
16+
17+
calculate_pyramid_height(input_Cube_number)

0 commit comments

Comments
 (0)