title: Problem with python while loop going over every element in 2d array
body: <p>I am having problems with while loops in python right now:</p>
  <pre><code>while(j &lt; len(firstx)):
      trainingset[j][0] = firstx[j]
      trainingset[j][1] = firsty[j]
      trainingset[j][2] = 1 #top
      
      print(trainingset)
      j += 1
  print(&quot;j is &quot; + str(j))
  i = 0
  while(i &lt; len(firsty)):
      trainingset[j+i][0] = twox[i]
      trainingset[j+i][1] = twoy[i]
      trainingset[j+i][2] = 0 #bottom
      i += 1
  </code></pre>
  <p>Where <code>trainingset = [[0,0,0]]*points*2</code> where <code>points</code> is a number. Also <code>firstx</code> and <code>firsty</code> and <code>twox</code> and <code>twoy</code> are all numpy arrays.</p>
  <p>I want the training set to have <code>2*points</code> array entries which go <code>[firstx[0], firsty[0], 1]</code> all the way to <code>[twox[points-1], twoy[points-1], 0]</code>.</p>
  <p>After some debugging, I am realizing that for each iteration, **every single value **in the training set is being changed, so that when <code>j = 0</code> all the training set values are replaced with <code>firstx[0]</code>, <code>firsty[0]</code>, and <code>1</code>.</p>
  <p>What am I doing wrong?</p>