-1

In order to reduce the quantity of code (and also lazyness) I did this in python thinking that it would make me write less than [[0,0],[0,0]....]

a = [[0,0]]*10 

However when I was assigning something like a[0][:] = [1,2], then all of my values became into [1,2] (like [[1,2]]*10)

I have checked and if I do the whole [[0,0],[0,0]....] I could solve the problem, but that's not good. Could anyone help me?

NachoB
  • 317
  • 4
  • 15

1 Answers1

-1

I solved it with Numpy.

a = np.array([[0, 0]] * 10)
Elmar Peise
  • 11,706
  • 3
  • 20
  • 40