Iterating through a list and using ltems of other lists
<pre><code>l = ['hello','hi']
a=[1,2,3,4]
b=[4,5,6,7]
for i in l:
 func(x=a[index],y=b[index])
</code></pre>

<p>Now when I'm iterating through l , in the first iteration i want to use first a[0]and b[0] for a function and then use a[1] and b[1] for the same function</p>

<p>And in the second iteration of l,i want to use first a[2]and b[2] for the function and then use a[3] and b[3] for the same function.</p>

<p>Any recommendations would be appreciated.</p>

<pre><code>&gt;&gt;&gt; l = ['hello','hi']
&gt;&gt;&gt; a=[1,2,3,4]
&gt;&gt;&gt; b=[4,5,6,7]
&gt;&gt;&gt; for i, val in enumerate(l):
...     print '---iteration', i
...     print 'l:', val
...     print 'a:', a[2*i], ', b:', b[2*i]
...     print 'a:', a[2*i+1], ' b:', b[2*i+1]
...
---iteration 0
l: hello
a: 1 , b: 4
a: 2  b: 5
---iteration 1
l: hi
a: 3 , b: 6
a: 4  b: 7
</code></pre>

python python-2.7