Browse Source

Sujet 1, calcul de notes et de moyennes

master
maxence.aubailly 4 weeks ago
parent
commit
328a565def
  1. 5
      Projets_note.py

5
Projets_note.py

@ -6,6 +6,7 @@ screen.title("Calcul de notes")
screen.minsize(300, 300) screen.minsize(300, 300)
screen.maxsize(300, 300) screen.maxsize(300, 300)
# Initialisation de la liste
lst_nombre = [] lst_nombre = []
# Différents textes présents (ou non) sur la page # Différents textes présents (ou non) sur la page
@ -61,9 +62,11 @@ def Calcul():
nombre_notes += 1 nombre_notes += 1
moyenne = total/nombre_notes moyenne = total/nombre_notes
moyenne = round(moyenne, 1) 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_min.config(text=f"Note la plus basse : {note_min}")
txt_note_max.config(text=f"Note la plus haute : {note_max}") txt_note_max.config(text=f"Note la plus haute : {note_max}")
txt_moyenne.config(text=f"Moyenne du groupe : {moyenne}") txt_moyenne.config(text=f"Moyenne du groupe : {moyenne}")
# Si quelq'un fait calculer une liste vide
except IndexError: except IndexError:
txt_note_min.config(text="") txt_note_min.config(text="")
txt_note_max.config(text="") txt_note_max.config(text="")
@ -76,7 +79,7 @@ def Effacer():
lst_nombre = [] 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 = tk.Button(width = 8, height = 3, text = "Vérifier", command=Verif)
bouton_verif.place(relx=0.5, rely=0.7, anchor="center") bouton_verif.place(relx=0.5, rely=0.7, anchor="center")

Loading…
Cancel
Save