-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_bac_gen.py
74 lines (66 loc) · 2.17 KB
/
data_bac_gen.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
63
64
65
66
67
68
69
70
71
72
73
74
from data_sorted import return_note_matiere
class Coefficients:
def __init__(self):
self.coefficients = {
'Francais': 10,
'Philosophie': 8,
'Specialite1': 16,
'Specialite2': 16,
'GrandOral': 10,
'SpecialiteAbandonnee': 8,
'HistoireGeographie': 6,
'LangueVivanteA': 6,
'LangueVivanteB': 6,
'EnseignementScientifique': 6,
'EPS': 6,
'EnseignementMoralCivique': 2
}
def calculate_average(self, grades):
total_points = 0
total_coef = 0
for subject, coef in self.coefficients.items():
if subject in grades:
total_points += grades[subject] * coef
total_coef += coef
if total_coef == 0:
return 0 # To avoid division by zero
average = total_points / total_coef
return average
class Predict_Algo:
def __init__(self, notes):
self.notes = return_note_matiere(notes)
self.notes_list_raw = notes
def Philosophie_gen(self):
Note_FINAL = 1
total_coef = 0
for notes in self.notes:
if notes['Matière'] == 'PHILOSOPHIE':
for note in notes['List_Note']:
coef = int(note['Coef'])
single_note = int(note['Note'])
if coef > 1:
total_coef += 4
Note_FINAL += (single_note * 4)
elif coef > 0:
total_coef += 1
Note_FINAL += (single_note)
else:
print("Warning: Coefficient is 0 or negative. Skipping this entry.")
Note_FINAL += (self.notes_list_raw['average'] * 1)
total_coef += 1
return (format(Note_FINAL/total_coef, '.1f'))
def Specialité_gen(self, nom_spe):
"""Note_FINAL = 1
for notes in self.notes:
if notes['Matière'] == str(nom_spe):
for note in notes['List_Note']:
coef = int(note['Coef'])
note = int(note['Note'])
if coef > 1.0:
Note_FINAL = Note_FINAL * note * coef
elif coef > 0:
Note_FINAL = Note_FINAL * note / 2
else:
print("Warning: Coefficient is 0 or negative. Skipping this entry.")
return Note_FINAL"""
pass