title: What is Python's equivalent of Java's standard for-loop?
body: <p>I'm writing a simple algorithm to check the primality of an integer and I'm having a problem translating this Java code into Python:</p>
  
  <pre class="lang-java prettyprint-override"><code>for (int i = 3; i &lt; Math.sqrt(n); i += 2) {
      if (n % i == 0)
          return false;
  }
  </code></pre>
  
  <p>So, I've been trying to use this, but I'm obviously skipping the division by 3:</p>
  
  <pre class="lang-py prettyprint-override"><code>i = 3
  while (i &lt; int(math.sqrt(n))):
      i += 2  # where do I put this?
      if (n % i == 0):
          return False
  </code></pre>