title: Storing multiple arrays in Python
body: <p>I am writing a program to simulate the actual polling data companies like Gallup or Rasmussen publish daily: <em><a href="http://www.gallup.com" rel="nofollow noreferrer">www.gallup.com</a></em> and <em><a href="http://www.rassmussenreports.com" rel="nofollow noreferrer">www.rassmussenreports.com</a></em></p>
  <p>I'm using a brute force method, where the computer generates some random daily polling data and then calculates three day averages to see if the average of the random data matches pollsters numbers. (Most companies poll numbers are three day averages)</p>
  <p>Currently, it works well for one iteration, but my goal is to have it produce the most common simulation that matches the average polling data. I could then change the code of anywhere from 1 to 1000 iterations.</p>
  <p>And this is my problem. At the end of the test I have an array in a single variable that looks something like this:</p>
  <pre><code>[40.1, 39.4, 56.7, 60.0, 20.0 ..... 19.0]
  </code></pre>
  <p>The program currently produces one array for each correct simulation. <em>I can store each array in a single variable, but I then have to have a program that could generate 1 to 1000 variables depending on how many iterations I requested!?</em></p>
  <p>How do I avoid this? I know there is an intelligent way of doing this that doesn't require the program to generate variables to store arrays depending on how many simulations I want.</p>
  <p>Code testing for McCain:</p>
  <pre><code> test = [] 
  
  while x &lt; 5: 
  
     test = round(100*random.random())
  
     mctest.append(test) 
  
     x = x +1 
  
  
  mctestavg = (mctest[0] + mctest[1] + mctest[2])/3 
  
  #mcavg is real data
  
  if mctestavg == mcavg[2]: 
    mcwork = mctest 
  </code></pre>
  <p>How do I repeat without creating multiple mcwork vars?</p>