Python: Compare elements in two list by pair
<p>I am so sorry for asking so silly question.
So I have got two lists(columns) for instance:</p>

<pre><code>In:
a= [0.0,1.0,2.0,3.0,4.0]
b= [1.0,2.0,3.0,5.0,6.0]
zp = list(zip(a,b)) #And I zipped it for better view.
for i in zp:
    print (i)

Out:
(0.0, 1.0)
(1.0, 2.0)
(2.0, 3.0)
(3.0, 5.0)
(4.0, 6.0)
</code></pre>

<p>I would like compare each i[1] with each i[0] in the next pair(tuple)
For example:</p>

<pre><code>1st pair i[1] = 1.0 compare with i[0] in 2nd
2nd pair i[0] = 1.0 compare with i[0] in 3rd
etc
</code></pre>

<p>I would like find difference in pair. </p>

<pre><code>If i[1] != i[0] 
  print this value 

Answer is 5.0 &amp; 4.0
</code></pre>

<p>Thank you for your attention </p>

<p>The initial zip for better view is not completely necessary. </p>

<p>You could simply <code>zip</code> a slice of <code>a</code> starting from index 1 with <code>b</code>, and then compare the items using a <code>for</code> loop:</p>

<pre><code>a = [0.0,1.0,2.0,3.0,4.0]
b = [1.0,2.0,3.0,5.0,6.0]

for i, j in zip(a[1:], b):
    if i != j:
        print(j, i)
#            5.0, 4.0
</code></pre>

python list compare