-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhafta4.py
More file actions
85 lines (76 loc) · 2.08 KB
/
hafta4.py
File metadata and controls
85 lines (76 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
ogrenciler = {
"ahmet": 50,
"mehmet": 100,
"ali": 56,
"fatma": 100,
"zeynep": 56
}
def ogrenci_ekle():
isim = input("Öğrenci adı: ").lower()
if isim in ogrenciler:
print("Bu öğrenci zaten mevcut!")
else:
notu = float(input("Not: "))
ogrenciler[isim] = notu
print(f"{isim} eklendi.")
def listele():
if not ogrenciler:
print("Henüz öğrenci eklenmedi.")
return
print("\n--- Öğrenci Listesi ---")
for isim, notu in ogrenciler.items():
if notu >= 50:
durum = "Geçti"
else:
durum = "Kaldı"
print(f"{isim} | Not: {notu} | Durum: {durum}")
def ortalama_hesapla():
if not ogrenciler:
print("Öğrenci yok, ortalama hesaplanamaz.")
return
ortalama = sum(ogrenciler.values()) / len(ogrenciler)
print(f"\nSınıf ortalaması: {ortalama:.2f}")
def en_yuksek_dusuk():
if not ogrenciler:
print("Liste boş.")
return
en_yuksek = max(ogrenciler, key=ogrenciler.get)
en_dusuk = min(ogrenciler, key=ogrenciler.get)
print(f"En yüksek not: {en_yuksek} - {ogrenciler[en_yuksek]}")
print(f"En düşük not: {en_dusuk} - {ogrenciler[en_dusuk]}")
def gecen_kalan():
gecenler = []
kalanlar = []
for isim,notu in ogrenciler.items():
if notu >= 50:
gecenler.append(isim)
else:
kalanlar.append(isim)
print(f"Geçenler: {gecenler}")
print(f"Kalanlar: {kalanlar}")
while True:
print("""
--- Öğrenci Not Sistemi ---
1- Öğrenci ekle
2- Tüm öğrencileri listele
3- Ortalama hesapla
4- En yüksek ve en düşük notu göster
5- Geçen ve kalan öğrencileri listele
6- Çıkış
""")
secim = input("Seçiminiz: ")
if secim == "1":
ogrenci_ekle()
elif secim == "2":
listele()
elif secim == "3":
ortalama_hesapla()
elif secim == "4":
en_yuksek_dusuk()
elif secim == "5":
gecen_kalan()
elif secim == "6":
print("Program sonlandırıldı.")
break
else:
print("Geçersiz seçim!")