How to evaluate an expression in for loop using Python?
<p>I want to evaluate an expression inside for loop. I am doing:</p>

<pre><code>for i in range(0,255):
    Q[i+1,1] = (np.floor_divide(i, q) * q + q/2)
</code></pre>

<p>but this returns an error saying </p>

<blockquote>
  <p>IndexError: index 1 is out of bounds for axis 1 with size 1". </p>
</blockquote>

<p>The size is 256x1 but still you have to index with starting at 0. So you need <code>Q[i,0]</code> </p>

python