-
Notifications
You must be signed in to change notification settings - Fork 0
/
media.py
62 lines (54 loc) 路 3.19 KB
/
media.py
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
from typing import get_args
from terminal_colors import COLORS as COLOR, print_color
class Proiezione:
def __init__(self, nome, voto, cfu) -> None:
self.nome = nome
self.voto = voto
self.cfu = cfu
def media_ponderata(exams):
counter_real = 0;
sum_real = 0;
for exam in exams:
if exam["Stato"] == "OK" and exam["Voto"] != "Idoneo":
sum_real += float(exam["Voto"])*float(exam["CFU"])
counter_real += float(exam["CFU"])
print("La tua media ponderata 猫 " + COLOR.GREEN + " %.2f" % (sum_real/counter_real))
input(COLOR.RESET + COLOR.ITALIC + "\nPremi invio per continuare" + COLOR.RESET)
def get_media_ponderata(exams):
counter_real = 0;
sum_real = 0;
for exam in exams:
if exam["Stato"] == "OK" and exam["Voto"] != "Idoneo":
sum_real += float(exam["Voto"])*float(exam["CFU"])
counter_real += float(exam["CFU"])
return sum_real/counter_real
def proietta_media(exams, materie):
counter_real = 0;
sum_real = 0;
for exam in exams:
if exam["Stato"] == "OK" and exam["Voto"] != "Idoneo":
sum_real += float(exam["Voto"])*float(exam["CFU"])
counter_real += float(exam["CFU"])
for materia in materie:
sum_real += materia.voto*materia.cfu
counter_real += materia.cfu
lista_materie = []
for materia in materie:
lista_materie.append(materia.nome)
print("La tua media ponderata proiettando le seguenti materie " + str(lista_materie) + " 猫 " + COLOR.GREEN + "%.2f" % (sum_real/counter_real))
input(COLOR.RESET + COLOR.ITALIC + "\nPremi invio per continuare" + COLOR.RESET)
def proietta_voto_laurea(exams, rimanenti_3_cfu, rimanenti_6_cfu, rimanenti_9_cfu, rimanenti_12_cfu, obiettivo_media):
counter_real = 0;
sum_real = 0;
for exam in exams:
if exam["Stato"] == "OK" and exam["Voto"] != "Idoneo":
sum_real += float(exam["Voto"])*float(exam["CFU"])
counter_real += float(exam["CFU"])
cfu_tot = counter_real + rimanenti_12_cfu*12 + rimanenti_6_cfu*6 + rimanenti_3_cfu*3
media_30_lode = 32*(rimanenti_12_cfu*12 + rimanenti_9_cfu*9 + rimanenti_6_cfu*6 + rimanenti_3_cfu*3) + sum_real
media_30 = 30*(rimanenti_12_cfu*12 + rimanenti_9_cfu*9 + rimanenti_6_cfu*6 + rimanenti_3_cfu*3) + sum_real
media_obiettivo = obiettivo_media*(rimanenti_12_cfu*12 + rimanenti_6_cfu*6 + rimanenti_3_cfu*3) + sum_real
print("La media finale se prendi tutti %d 猫 %s%.2f%s e il voto di laurea massimo 猫 %s%.2f%s - %s%.2f%s" % (obiettivo_media, COLOR.GREEN, float(media_obiettivo/cfu_tot), COLOR.RESET, COLOR.GREEN, int(float(media_obiettivo/cfu_tot)*(11/3))+4, COLOR.RESET, COLOR.GREEN, int(float(media_obiettivo/cfu_tot)*(11/3))+7, COLOR.RESET))
print("La media finale se prendi tutti 30 猫 %s%.2f%s e il voto di laurea massimo 猫 %s%.2f%s - %s%.2f%s" % (COLOR.GREEN, float(media_30/cfu_tot), COLOR.RESET, COLOR.GREEN, int(float(media_30/cfu_tot)*(11/3))+4, COLOR.RESET, COLOR.GREEN, int(float(media_30/cfu_tot)*(11/3))+7, COLOR.RESET))
print("La media finale se prendi tutti 30L 猫 %s%.2f%s e il voto di laurea massimo 猫 %s%.2f%s - %s%.2f%s" % (COLOR.GREEN, float(media_30_lode/cfu_tot), COLOR.RESET, COLOR.GREEN, int(float(media_30_lode/cfu_tot)*(11/3))+4, COLOR.RESET, COLOR.GREEN, int(float(media_30_lode/cfu_tot)*(11/3))+7, COLOR.RESET))
input(COLOR.RESET + COLOR.ITALIC + "\nPremi invio per continuare" + COLOR.RESET)