We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f1f0c5c + d1b48d4 commit b01f22aCopy full SHA for b01f22a
Week03/pyramid_kerem_kurtuldu.py
@@ -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