title: How do I create a for-loop where the variable's value is equal to the stop value of range when the loop runs to the end in Python?
body: <p>I'm having a conceptual problem porting this from C to Python:</p>
  
  <pre><code>int p;
  for (p = 32; p &lt; 64; p += 2) {
      if (some condition)
          break;
      do some stuff
  }
  return p;
  </code></pre>
  
  <p>Converting the loop to <code>for p in range(32,64,2)</code> does not work.  This is because after the loop ends, <code>p</code> is equal 62 instead of 64.</p>
  
  <p>I can do it with a <code>while</code> loop easily:</p>
  
  <pre><code>p = 32
  while p &lt; 64:
      if (some condition):
          break
      do some stuff
      p += 2
  return p
  </code></pre>
  
  <p>But I'm looking for a <strong>Pythonic way</strong>.</p>