fredrik at pythonware.com
Wed Oct 18 13:30:11 CEST 2006
> I wan't to multiply two square matrixes, and i don't understand why it
> doesn't work.
> def multmat(A,B):
> if len(A)!=len(B): return "error"
> for i in range(len(A)): D.append(0)
> for i in range(len(A)): C.append(D)
append doesn't copy data, so you're basically adding len(A) references to
the same D list to C. for more on this, see:
More information about the Python-list