How to iterate through a list of tuples in Python?
<pre><code>coordinates = [(i, j) for i, row in enumerate(mymatrix) for j, v in enumerate(row) if v == '0']
</code></pre>

<p>I have a list of coordinates (tuples) and would like to print the coordinate, the nearest tuple to the right of the coordinate and the next tuple within the same column as the coordinate. How would I do this for each coordinate?</p>

<p>For example:</p>

<pre><code>coordinates = [(0,0),(0,3),(1,0),(1,2),(1,3)]
</code></pre>

<p>Output for the first coordinate would be:</p>

<pre><code>0 0 0 3 1 0
</code></pre>

<p>Output for the second coordinate would be:</p>

<pre><code>0 3 -1 -1 1 3
</code></pre>