diff --git a/basket.py b/basket.py index 8558f4c..10931b3 100644 --- a/basket.py +++ b/basket.py @@ -1,7 +1,15 @@ def reussite(joueur, action): - #recuperer toutes les lignes débutant par joueur ET action (join et search?) with open('stats.txt', 'r') as stats: - stats = stats.read().strip() + stats = stats.readlines() + nb_action = 0 + nb_reussite_action = 0 + for ligne in stats: + ligne = ligne.strip().split(' ') + if ligne[0] == joueur and ligne[1].split('-')[0] == action: + nb_action += 1 + if ligne[0] == joueur and ligne[1].split('-')[1] == "reussi": + nb_reussite_action += 1 + return nb_action, nb_reussite_action def total_points(): #c'est un test return True \ No newline at end of file