Ciao Giuliano,

Io ti suggerisco invece di usare gli array invece delle liste. Perche' vuoi
usare vettori e matrici.  Nei prossimi esempi usero' gli array di numpy, ma
sappi che esistono anche nella libreria standard.

Traduciamo subito il tuo esempio

```
>>> import numpy as np
>>> m = np.array([[0]*3]*2)
>>> print(m)

array([[0, 0, 0],
       [0, 0, 0]])

>>> m[0][1] = 5
>>> print(m)

array([[0, 5, 0],
       [0, 0, 0]])
```

et les jeux sont fait!

Per essere piu' precisi, nel tuo caso, per inizializare sarebbe meglio
usare una funzione chiamata zeros.

```

np.zeros((2,3), dtype=int)
```

Infine... se ti vuoi divertire, c'e' questo bellissimo visualizzatore
di esecuzione di python.
http://www.pythontutor.com

Prova il tuo esempio e divertiti!




-- 
There is a crack, a crack in everything. That’s how the light gets in
L. Cohen
_______________________________________________
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python

Rispondere a