title: Python 3.7 iteration
body: <p>Given an integer <code>n</code>, the function <code>legendre_n</code> should return the number of prime numbers between <code>n^2</code> and <code>(n+1)^2</code>.</p>
  <p>My code is as such:</p>
  <pre><code>def is_prime(n):
     if n ==1:
        return False
     elif n ==2:
        return True
     elif n&gt;2 :
        for i in range(2, n):
          if n%i ==0:
              return False
          else:
              return True
  def legendre_n(n):
    counter = 0
    for i in range (n**2,(n+1)**2):
        if is_prime(i):
            counter = counter + 1
        else:
            counter+=0
     return counter
          
  print(legendre_n(1))  ==2
  print(legendre_n(2))  ==2
  print(legendre_n(3))  ==2
  print(legendre_n(12)) ==5
  </code></pre>
  <p>I'm supposed to get the above answers but instead I get 2 ,2 ,4, 12
  Any idea why?</p>