0
What's the defference between these codes that makes different outputs?
_In this python code: A=[[0]*8]*8 _and this other one: A=[] for h in range(8): b=[] for i in range(8): b.append(0) A.append(b) _what's the difference, that if I change something ( for example A[1][5]=6 ) , I'll have different outputs.
1 Antwort
0
I think that in the first option you will get simply an arrey of 64 ints.
In the second option the A.append(b) will create a list item from type arrey...and nit and not an Int. (a list within a list)