I have 3 lists of equal sizes (List1,2 and 3). I want to iterate through the list and and perform operations on each of the items. Like
for x in List1, y in List2, z in List3:
if(x == "X" or x =="x"):
//Do operations on y
elif(y=="Y" or y=="y"):
//Do operations on x,z
So I want to traverse the list only for "Length of List1 or 2 or size" and then perform operations on x,y and z. How can I do this using Python?
Edit: Python Version 2.6.6
import itertools
for x, y, z in itertools.izip(List1, List2, List3):
# ...
Or just zip
in Python 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With