title: python populating array using while loop
body: <p>All I am trying to do is populate an array with numbers in order. So, array[0][0] = 0, array[0][1]=1, etc. Why is this not working?  I cannot figure it out.</p>
  
  <pre><code>def populateArray(ar):
      count = 0
      i=0
      j=0
      while (i&lt;len(ar)):
          while (j&lt;len(ar[i])):
              ar[i][j] = count
              count = count + 1
              j=j+1
          j=0
          i=i+1
      return ar
  
  numColumns = input('how many columns?')
  numRows = input('how many rows?')
  arr = [[0]*int(numColumns)]*int(numRows)
  arr=populateArray(arr)
  print(arr)
  </code></pre>