Feb-03-2018, 01:22 PM
(This post was last modified: Feb-03-2018, 01:22 PM by Gribouillis.)
If you replace
if you write
At line 70, you need 'mal' instead of 'bien'
placement()
with this, it seems to be workingdef placement(): paires = list(zip(t, tableauEntree)) n = len(paires) paires = [(u, v) for u, v in paires if u != v] compteurBienPlaces = n - len(paires) if paires: a, b = zip(*paires) compteurMalPlaces = sum(1 for x in b if x in a) else: compteurMalPlaces = 0 tableauPlacement[:] = [compteurBienPlaces, compteurMalPlaces]In your code at line 28, you need
tableauPlacement[:] = [0, 0]
becauseif you write
tableauPlacement = [0, 0]
, this variable becomes a local variable and the global tableauPlacement is not changed, but there are other errors.At line 70, you need 'mal' instead of 'bien'