title: run for-loop for large numbers in python
body: <pre><code> for i in range(1000000000):
   print(i)
  </code></pre>
  
  <p>This snippet gives memory error than How to run this loop. Any suggestions on how to run it.Thanks.</p>
  
  <pre><code>&gt;&gt;&gt;MemoryError
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  Actually I was trying something like this:</p>
  
  <pre><code>arr = []
  
  for i in xrange(1000000000):
      arr.append(i*i)
  print(max(set(arr)))
  </code></pre>
  
  <p>I don't know how to deal with such large numbers.</p>