title: Primality Test not working in Python
body: <p>I have been trying to compact my code for a primality test in python so that it makes use of list comprehensions, but for some reason it doesn't return the correct results:</p>
  
  <pre><code>def isPrime(n):
      if n &gt; 1:
          for i in range(2, int(n ** 0.5) + 1):
              if n % i == 0:
                  return False
          return True
  </code></pre>
  
  <p>That's the code for my current primality test, but I want to condense it:</p>
  
  <pre><code>def isPrime(n):
  if n &gt; 1:
      return [False for i in range(2, int(n ** 0.5) + 1) if n % i == 0]
      return True
  </code></pre>
  
  <p>I tried the above, but it outputs all non-prime integers up to n. What am I doing wrong?</p>