From 6bc08bea87f079bcfc46082486e818007e052eff Mon Sep 17 00:00:00 2001 From: "laneury.a" <> Date: Tue, 11 Feb 2025 09:41:21 +0100 Subject: [PATCH] crea de la fnc + fnc fonctionnelle --- fonction_totalPoints.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 fonction_totalPoints.py diff --git a/fonction_totalPoints.py b/fonction_totalPoints.py new file mode 100644 index 0000000..79832d2 --- /dev/null +++ b/fonction_totalPoints.py @@ -0,0 +1,28 @@ +from fonction_points import points +def totalPoints (joueur): + total_pts = 0 + with open("stats.txt") as stats: + for ligne in stats : + ligne=ligne.strip() #nettoyage des lignes + lst_elements = ligne.split(' ') #decoupage sur les espaces + + if lst_elements[0] == joueur : + + if lst_elements[1]=="tir-reussi": + x = lst_elements[2] + y = lst_elements[3] + #print(lst_elements[0],lst_elements[1],x,y) + total_pts = total_pts + points(x,y) + #print(points(x,y)) + + return total_pts + + +"""tests""" +for i in range (1,11): + joueur = "J" + str(i) + print(joueur,totalPoints(joueur)) + +for i in range (1,11): + joueur = "J" + str(i) + "V" + print(joueur,totalPoints(joueur))