Path: blob/master/Dosya İşlemleri/Kodlama Egzersizleri/not_hesaplama.py
765 views
def not_hesapla(satır):123satır = satır[:-1]45liste = satır.split(",")67isim = liste[0]89not1 = int(liste[1])1011not2 = int(liste[2])1213not3 = int(liste[3])1415son_not = not1 * (3/10) + not2 * (3/10) + not3 * (4/10)1617if (son_not >= 90):1819harf = "AA"20elif (son_not >= 85):21harf = "BA"22elif (son_not >= 80):23harf = "BB"24elif (son_not >= 75):25harf = "CB"26elif (son_not >= 70):27harf = "CC"28elif (son_not >= 65):29harf = "DC"30elif (son_not >= 60):31harf = "DD"32elif (son_not >= 55):33harf = "FD"34else:35harf = "FF"3637return isim + "------------------> " + harf + "\n"3839404142434445with open("dosya.txt","r",encoding= "utf-8") as file:4647eklenecekler_listesi = []4849for i in file:5051eklenecekler_listesi.append(not_hesapla(i))5253with open("notlar.txt","w",encoding="utf-8") as file2:5455for i in eklenecekler_listesi:56file2.write(i)575859606162