title: How to allocate array size in Python
body: <p>Python newbie here. I've searched quite a bit for a solution to this but nothing quite fits what I need. I would like to allocate an empty array at the start of my program that has a rows and b columns. I came up with a solution but encountered an interesting problem that I didn't expect. Here's what I had:</p>
  
  <pre><code>a = 7
  b = 5
  array_ab = [['?'] * b] * a
  </code></pre>
  
  <p>which produces</p>
  
  <pre><code>[['?', '?', '?', '?', '?'],
   ['?', '?', '?', '?', '?'],
   ['?', '?', '?', '?', '?'],
   ['?', '?', '?', '?', '?'],
   ['?', '?', '?', '?', '?'],
   ['?', '?', '?', '?', '?'],
   ['?', '?', '?', '?', '?']]
  </code></pre>
  
  <p>However, if I try to change a single element, it treats every row as the same object and effectively changes the entire column to that element. So for example</p>
  
  <pre><code>array_ab[4][2] = '1'
  </code></pre>
  
  <p>produces</p>
  
  <pre><code>[['?', '?', '1', '?', '?'],
   ['?', '?', '1', '?', '?'],
   ['?', '?', '1', '?', '?'],
   ['?', '?', '1', '?', '?'],
   ['?', '?', '1', '?', '?'],
   ['?', '?', '1', '?', '?'],
   ['?', '?', '1', '?', '?']]
  </code></pre>
  
  <p>Clearly I need a better way to create the blank array than by multiplication. Is there a solution to this in python? (It was so simple in FORTRAN!)</p>