title: Double For Loops Python
body: <pre><code>for n in range(2, 6):
      for x in range(2, n):
          if n % x == 0:
              print(n, 'equals', x, '*', n // x)
              break
          elif x + 1 == n:
              print(n, 'is a prime number')
  </code></pre>
  
  <p>Result: </p>
  
  <pre><code>3 is a prime number 
  4 equals 2 * 2 
  5 is a prime number
  </code></pre>
  
  <p>Can anybody explain me the double for loop, why does it skip the number 2? Is it because the last number is not included in for x in range (2,2), how does this program work when iterates using 3, I tried doing the second for loop by itself using 3 and i get 2 and on another line 3, so what does it do in the third line with n%x ==0. And what does it do in the 6th line using 3? Thank you I'd appreciate it if you can walk me through this. </p>