Skip to content

Commit 887e974

Browse files
authored
Create pyramid_esra_kaya.py
1 parent df3f3dd commit 887e974

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Week03/pyramid_esra_kaya.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def calculate_pyramid_height(kup_sayisi):
2+
if kup_sayisi <= 0:
3+
return "Küp sayısı sıfırdan büyük olmalıdır."
4+
5+
toplam_kup = 0
6+
yukseklik = 0
7+
8+
while toplam_kup < kup_sayisi:
9+
yukseklik += 1
10+
toplam_kup += yukseklik
11+
12+
if toplam_kup == kup_sayisi:
13+
return yukseklik
14+
15+
# Eğer toplam_kup, kup_sayisi'ni aşarsa bu piramit oluşturulamaz.
16+
return "Bu küp sayısıyla bir piramit oluşturulamaz."

0 commit comments

Comments
 (0)