l1 = [[1, 2], [3, 4]]l2 = [[0]*4]*4for i in range(2): for j in range(2): l2[i][j] = l1[i][j] * - 1print(l2)
Standard input is empty
[[-3, -4, 0, 0], [-3, -4, 0, 0], [-3, -4, 0, 0], [-3, -4, 0, 0]]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!