1 changed files with 30 additions and 0 deletions
@ -0,0 +1,30 @@ |
|||||
|
# petit test pour être sûr d'avoir le bon fichier |
||||
|
with open("stats.txt", "r") as f: |
||||
|
lignes = f.readlines() |
||||
|
#print(lignes) |
||||
|
|
||||
|
|
||||
|
# fonctions pour dire actions raté d'un joueur |
||||
|
def manque(joueur): |
||||
|
manque_action = 0 |
||||
|
# convertit toutes les lignes en listes |
||||
|
with open("stats.txt","r") as f: |
||||
|
for ligne in f: |
||||
|
ligne_clean = ligne.strip() |
||||
|
lst_ligne = ligne_clean.split() |
||||
|
#print(lst_ligne) |
||||
|
|
||||
|
|
||||
|
# regarde toutes les listes contenant le joueur et regarde ensuite ses erreurs |
||||
|
if lst_ligne[0] == joueur and (lst_ligne[1] == "tir-manque" or lst_ligne[1] == "perteBalle"): |
||||
|
print(lst_ligne) |
||||
|
manque_action += 1 |
||||
|
|
||||
|
return manque_action |
||||
|
|
||||
|
|
||||
|
|
||||
|
# test |
||||
|
joueur = input() |
||||
|
manque(joueur) |
||||
|
print("Le joueur",joueur,"a manqué",manque(joueur),"actions .") |
Loading…
Reference in new issue