Elegant way to manipulate lists within list?
<p><strong>EDIT</strong>: I've changed my question slightly to make it more general whereby the i in p[i][j] can also change.</p>

<p>Very new to Python. I have lists [of equal length] within a list, which makes a 4 row by 5 column grid:</p>

<pre><code>p = [[1.0, 3.0, 4.0, 1.0, 1.0],
     [1.0, 1.0, 5.0, 1.0, 1.0],
     [1.0, 6.0, 6.0, 1.0, 1.0],
     [1.0, 4.0, 1.0, 1.0, 6.0]]
</code></pre>

<p>To manipulate each cell, what I'm doing now is this:</p>

<pre><code>for i in range(len(p)):
    for j in range(len(p[0])):
        p[i][j] = p[i][j - 1] * c1 + p[(i + 1) % len(p)][j] * c2
</code></pre>

<p>My question is: Is there a more elegant way to write this instead of having a for loop within another for loop? Perhaps using lambda?</p>
