def not_hesapla(satir):
liste=satir.split(",")
isim=liste[0]
not1=int(liste[1])
not2=int(liste[2])
not3=int(liste[3])
nothesap= (not1+not2+not3) /3
if (nothesap>= 90):
harf = "AA"
elif (nothesap >= 85):
harf = "BA"
elif (nothesap >= 80):
harf = "BB"
elif (nothesap >= 75):
harf = "CB"
elif (nothesap >= 70):
harf = "CC"
elif (nothesap >= 65):
harf = "DC"
elif (nothesap >= 60):
harf = "DD"
elif (nothesap >= 55):
harf = "FD"
else:
harf = "FF"
return isim+" = "+ str(harf) +"\n"
with open("notlar.txt","r",encoding="utf-8") as file:
notlar = []
for i in file:
notlar.append(not_hesapla(i))
with open("notlar1.txt","w",encoding="utf-8") as file2:
for j in notlar:
file2.write(j)
with open("notlar1.txt","r",encoding="utf-8") as file:
for i in file:
student = i.strip().split(" = ")
print("name:", student[0], "grade:", student[1])