From 328a565def8cde9deb7e8116fb448cf3f297cbf0 Mon Sep 17 00:00:00 2001 From: "maxence.aubailly" Date: Mon, 24 Mar 2025 09:05:43 +0100 Subject: [PATCH] Sujet 1, calcul de notes et de moyennes --- Projets_note.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Projets_note.py b/Projets_note.py index c90862c..7307ba4 100644 --- a/Projets_note.py +++ b/Projets_note.py @@ -6,6 +6,7 @@ screen.title("Calcul de notes") screen.minsize(300, 300) screen.maxsize(300, 300) +# Initialisation de la liste lst_nombre = [] # Différents textes présents (ou non) sur la page @@ -61,9 +62,11 @@ def Calcul(): nombre_notes += 1 moyenne = total/nombre_notes moyenne = round(moyenne, 1) + # Remplace les textes vides par les notes txt_note_min.config(text=f"Note la plus basse : {note_min}") txt_note_max.config(text=f"Note la plus haute : {note_max}") txt_moyenne.config(text=f"Moyenne du groupe : {moyenne}") + # Si quelq'un fait calculer une liste vide except IndexError: txt_note_min.config(text="") txt_note_max.config(text="") @@ -76,7 +79,7 @@ def Effacer(): lst_nombre = [] -# Différents bouton qui renvoie aux deux fonctions +# Différents bouton qui renvoie aux trois fonctions bouton_verif = tk.Button(width = 8, height = 3, text = "Vérifier", command=Verif) bouton_verif.place(relx=0.5, rely=0.7, anchor="center")