title: Generator function for prime numbers
body: <p>I'm trying to write a generator function for printing prime numbers as follows</p>
  
  <pre><code> def getPrimes(n):
      prime=True
      i=2
      while(i&lt;n):
          for a in range(2,i):
              if(i%a==0):
                  prime=False
                  break
          if(prime):    
              yield i
  </code></pre>
  
  <p>However I'm not getting the desired results
  p=getPrimes(100) should give me a generator function that will iterate primes from 2 through 100 but the result I'm getting is [2,3]. What am I doing wrong?</p>