Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mustafamuratcoskun
GitHub Repository: mustafamuratcoskun/Sifirdan-Ileri-Seviyeye-Python-Programlama
Path: blob/master/Dosya İşlemleri/Kodlama Egzersizleri/not_hesaplama.py
765 views
1
def not_hesapla(satır):
2
3
4
satır = satır[:-1]
5
6
liste = satır.split(",")
7
8
isim = liste[0]
9
10
not1 = int(liste[1])
11
12
not2 = int(liste[2])
13
14
not3 = int(liste[3])
15
16
son_not = not1 * (3/10) + not2 * (3/10) + not3 * (4/10)
17
18
if (son_not >= 90):
19
20
harf = "AA"
21
elif (son_not >= 85):
22
harf = "BA"
23
elif (son_not >= 80):
24
harf = "BB"
25
elif (son_not >= 75):
26
harf = "CB"
27
elif (son_not >= 70):
28
harf = "CC"
29
elif (son_not >= 65):
30
harf = "DC"
31
elif (son_not >= 60):
32
harf = "DD"
33
elif (son_not >= 55):
34
harf = "FD"
35
else:
36
harf = "FF"
37
38
return isim + "------------------> " + harf + "\n"
39
40
41
42
43
44
45
46
with open("dosya.txt","r",encoding= "utf-8") as file:
47
48
eklenecekler_listesi = []
49
50
for i in file:
51
52
eklenecekler_listesi.append(not_hesapla(i))
53
54
with open("notlar.txt","w",encoding="utf-8") as file2:
55
56
for i in eklenecekler_listesi:
57
file2.write(i)
58
59
60
61
62