1 changed files with 19 additions and 0 deletions
@ -0,0 +1,19 @@ |
|||
def rebondsPasses(joueur): |
|||
"""Calcule le nombre de rebonds et de passes pour un joueur.""" |
|||
rebonds = 0 |
|||
passes = 0 |
|||
|
|||
with open("stats.txt", "r") as fichier: |
|||
for ligne in fichier: |
|||
data = ligne.split() |
|||
if data[0] == joueur: |
|||
if "rebond" in data[1]: |
|||
rebonds += 1 |
|||
elif data[1] == "passe": |
|||
passes += 1 |
|||
|
|||
return rebonds, passes |
|||
|
|||
# Test |
|||
if __name__ == "__main__": |
|||
print(rebondsPasses("J1")) |
Loading…
Reference in new issue