title: What's wrong with this python prime number function?
body: <p>So I just want to check what's wrong with my function. It gives out prime numbers just fine but when I put in a number like 4, it prints "4 is not prime" then "4 is a prime number."
  What seems to be the error? (I know it's sad, but I spent 8 hours doing this(beginner)).</p>
  
  <pre><code>def isprime(n):
      if n == 1:
          print ("1 is not prime.")
      if n == 2:
          print ("2 is a prime number.")
      for x in range (2, n):
          if n%x == 0:
              print (n, "is not prime.")
          if n%x != 0:
              print (n, "is a prime number.")
  </code></pre>