title: How to intentionally slow down a python script so I can have it running forever in the background while I work?
body: <p>So basically I have a list of 300 values and different averages associated with each one.</p>
  
  <p>I have a <strong><code>for</code></strong>-loop that generates a list of ten of these values at random, and writes it to excel if certain conditions are met based on their averages.</p>
  
  <p>The code runs fine if I loop through 10 million times or less, but that is orders of magnitudes too small. Even if I just double the for loop counter to 20 million my computer becomes unusable while it is running. </p>
  
  <p>I want to iterate the loop 100 million or 1 billion times even. I want it to run slowly in the background, I don't care if it takes 24 hours to get to the results. I just want to use my computer while it's working. Currently, if the for loop goes past 10 million the memory and disk usage of my laptop go to 99%. </p>
  
  <p><strong>Using</strong> <code>pyScripter</code> and python 3.3</p>
  
  <p><strong>Comp specs:</strong> Intel Core i7 4700HQ (2.40GHz) 8GB Memory 1TB HDD NVIDIA GeForce GTX 850M 2GB GDDR3</p>
  
  <p><strong>Code snippet:</strong></p>
  
  <pre><code>for i in range( 0, cycles ):
      genRandLineups( Red );                     #random team gens
      genRandLineups( Blue );
      genRandLineups( Purple );
      genRandLineups( Green );
  
      if          sum( teamAve[i] )    &lt;= 600
          and ( ( sum( teamValues[i] ) &gt;  currentHighScore )
              or  sum( teamValues[i] ) &gt;  1024 
              ):
          teamValuesF.append( teamValues[i] )
  
  
          sheetw.write( q, 0, str( teamValues[i] ) )
          ts = time.time()
          workbookw.save( "Data_Log.xls" )
          st = datetime.datetime.fromtimestamp( ts ).strftime( '%Y-%m-%d %H:%M:%S' )
          sheetw.write( q, 3, st )
          q = q + 1
  
          if sum( teamValues[i] ) &gt; currentHighScore:
              currentHighScore = sum( teamValues[i] )
  </code></pre>