title: Nested List Comprehension With Flow Control
body: <p>I am attempting to write the following code as a one-liner.</p>
  
  <pre><code>for x in range(a, b+1):
     prime = True
     for y in range(2, int(x**0.5)):
       if x%y == 0:
         prime = False
         break
     if prime:
       return x
  </code></pre>
  
  <p>This is searching for prime numbers between a and b. I will saving each prime number into a list. The code above above is checking each number in the range for primality. The problem is that I must write this nested loop as a one-line list comprehension. The problem I have is that the list comprehension will not go through the second loop. It will check with 2, then pop out of the loop.</p>
  
  <p>I tried this approach, and it failed miserably:
           <code>([x for x in range(10, 21) for y in range(2, int(x**0.5)) if x%y != 0])</code></p>