Skip to content

Commit f43056e

Browse files
authored
Merge pull request #741 from wxmaxw/patch-2
Create pyramid_merve_yagiz.py
2 parents 50c7545 + e4fce9a commit f43056e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Week03/pyramid_merve_yagiz.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
# number_of_blocks = 10
3+
4+
def calculate_pyramid_height(number_of_blocks):
5+
block = 1
6+
height = 0
7+
while number_of_blocks >= block: # Koşulu düzelttik
8+
number_of_blocks -= block # number_of_blocks değerini güncelliyoruz
9+
#print("Kalan blok:", number_of_blocks)
10+
height += 1
11+
#print("Height:", height)
12+
block += 1
13+
#print("Block:", block)
14+
return height
15+
16+
# Fonksiyonu çağırarak sonucu görelim
17+
#print("Pyramid height:", calculate_pyramid_height(number_of_blocks))
18+

0 commit comments

Comments
 (0)