def not_hesapla(satır):
global harf
satır=satır[:-1]
liste=satır.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>=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, son_not, harf,]
with open("dosya.txt","r",encoding="utf-8") as file:
for i in file:
i=not_hesapla(i)
with open("notlar.txt","a", encoding="utf-8") as file2:
file2.write(i[0]+"------>"+i[2]+"\n")
if(i[1]<=60):
with open("kalanlar.txt","a", encoding="utf-8") as file3:
file3.write(i[0] + "------>" + i[2] + "\n")
else:
with open("gecenler.txt","a", encoding="utf-8") as file4:
file4.write(i[0] + "------>" + i[2] + "\n")