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.
16 lines
457 B
16 lines
457 B
def reussite(joueur, action):
|
|
tentatives = 0
|
|
reussites = 0
|
|
with open('stats.txt', 'r') as f:
|
|
for ligne in f:
|
|
mots = ligne.split()
|
|
if mots[0] == joueur and mots[1] == action:
|
|
tentatives += 1
|
|
if mots[2] == 'reussi' or mots[2] == 'reussie':
|
|
reussites += 1
|
|
return (tentatives, reussites)
|
|
|
|
# Exemple
|
|
joueur = 'J1'
|
|
action = 'tir'
|
|
print(reussite(joueur, action))
|
|
|