You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
508 B
19 lines
508 B
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"))
|
|
|