1 | initial version |
Another option, which is just a small modification of the original code:
sage: Z = [[141,163,127],[107,132,117],[85,116,120],[121,131,128]]
sage: ZZ = copy(Z)
sage: [ZZ[i].insert(i,0) for i in range(len(ZZ))]; ZZ
[[0, 141, 163, 127], [107, 0, 132, 117], [85, 116, 0, 120], [121, 131, 128, 0]]