Bu kodda nerede hata yapıyorum?

Selam, gecenler ve kalanlar listesi hazirlamak istiyorum ancak yazdığım kodlar gecenler.txt’ye yazilmiyor bana yardimci olur musunuz ?

def not_hesapla(satır):
satır = satır [:-1]
liste = satır.split(",")
print(liste)

isim = (liste[0])
not1 = int(liste[1])
not2 = int(liste[2])
not3 = int(liste[3])

son_not = not1 * (3/10) + not2 * (3/10) + not3 * (4/10)

if (son_not >= 90):
    harf = ("AA")

elif(son_not >= 85):
    harf = ("BA")
elif (son_not >= 80):
    harf = ("BB")
elif (son_not >= 75):
    harf = ("CB")
elif (son_not >= 70):
    harf = ("CC")
elif (son_not >= 65):
    harf = ("DC")
elif (son_not >= 60):
    harf = ("DD")
elif (son_not >= 55):
    harf = ("FD")
else:
    harf = ("ff")
return isim + "--------------------------------->" + harf + "\n"

def gecenler_hesapla(gecenler):

gecenler = gecenler[:-1]
liste = gecenler.split(",")
isim = (liste[0])
not1 = int(liste[1])
not2 = int(liste[2])
not3 = int(liste[3])
son_not = not1 * (3 / 10) + not2 * (3 / 10) + not3 * (4 / 10)

if(son_not >=60):
    durum = "Geçtin"
    return isim + "---------------------->" + durum

with open (“dosya.txt”, “r”,encoding=“utf-8”) as file:
eklenecekler_listesi = []
#kalanlar_listesi = []
gecenler_listesi = []
for i in file:
eklenecekler_listesi.append(not_hesapla(i))
#kalanlar_listesi.append(kalanlar_hesapla(i))
#kalanlar_hesapla(i)
gecenler_listesi.append(gecenler_hesapla(i))
with open (“notlar.txt”,“w”,encoding=“utf-8”) as file2:

    for i in eklenecekler_listesi:
        file2.write(i)
    with open("gecenler.txt","w",encoding="utf-8")as file4:

        for i in gecenler_listesi:
            file4.write(i)
    # with open ("kalanlar.txt","w",encoding="utf-8") as file3:

        #for i in kalanlar_hesapla:
            #file3.write(i)

Kodların tamamı ` arasında değil o yüzden girintiler anlaşılmıyor.

def not_hesapla(satır):
satır = satır [:-1]
liste = satır.split(",")
print(liste)

isim = (liste[0])
not1 = int(liste[1])
not2 = int(liste[2])
not3 = int(liste[3])

son_not = not1 * (3/10) + not2 * (3/10) + not3 * (4/10)

if (son_not >= 90):
    harf = ("AA")

elif(son_not >= 85):
    harf = ("BA")
elif (son_not >= 80):
    harf = ("BB")
elif (son_not >= 75):
    harf = ("CB")
elif (son_not >= 70):
    harf = ("CC")
elif (son_not >= 65):
    harf = ("DC")
elif (son_not >= 60):
    harf = ("DD")
elif (son_not >= 55):
    harf = ("FD")
else:
    harf = ("ff")
return isim + "--------------------------------->" + harf + "\n"

def gecenler_hesapla(gecenler):

gecenler = gecenler[:-1]
liste = gecenler.split(",")
isim = (liste[0])
not1 = int(liste[1])
not2 = int(liste[2])
not3 = int(liste[3])
son_not = not1 * (3 / 10) + not2 * (3 / 10) + not3 * (4 / 10)

if(son_not >=60):
    durum = "Geçtin"
    return isim + "---------------------->" + durum

with open ("dosya.txt", "r",encoding="utf-8") as file:
  eklenecekler_listesi = []
#kalanlar_listesi = []
gecenler_listesi = []
for i in file:
    eklenecekler_listesi.append(not_hesapla(i))
    #kalanlar_listesi.append(kalanlar_hesapla(i))
    #kalanlar_hesapla(i)
    gecenler_listesi.append(gecenler_hesapla(i))
with open ("notlar.txt","w",encoding="utf-8") as file2:

    for i in eklenecekler_listesi:
        file2.write(i)
    with open("gecenler.txt","w",encoding="utf-8")as file4:

        for i in gecenler_listesi:
            file4.write(i)
    # with open ("kalanlar.txt","w",encoding="utf-8") as file3:

        #for i in kalanlar_hesapla:
            #file3.write(i)

hallettim ben yine de tesekkur ederim.

1 Beğeni