title: Find the next prime number in Python
body: <p>I have a function that takes a number (for example, 5) and returns the first prime number after the input number (in this case, it would be 7).</p>
  
  <p>This is my code:</p>
  
  <pre><code>def prime(n):
      np=[]
      isprime=[]
      for i in range (n+1,n+200):
          np.append(i)
      for x in range(2,199):
          for j in np:
              if x%j!=0:
                  isprime.append(x)
      return min(isprime)
  </code></pre>
  
  <p>However, this code doesn't work (it always returns 2). Where is the mistake?</p>