Skip to content

Commit b01f22a

Browse files
authored
Merge pull request #834 from keremkurtuldu/patch-3
Create pyramid_kerem_kurtuldu.py
2 parents f1f0c5c + d1b48d4 commit b01f22a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Week03/pyramid_kerem_kurtuldu.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def calculate_pyramid_height(blocks):
2+
# Initialize height and the number of blocks needed for the first level
3+
height = 0
4+
current_level = 1
5+
6+
# Continue building levels as long as there are enough blocks
7+
while blocks >= current_level:
8+
blocks -= current_level # Use blocks for the current level
9+
height += 1 # Increment the pyramid's height
10+
current_level += 1 # Move to the next level
11+
12+
return height # Return the total height of the pyramid

0 commit comments

Comments
 (0)