Read element in a zipped list : zip « Buildin Function « Python






Read element in a zipped list

Read element in a zipped list

L1 = [1,2,3,4]
L2 = [5,6,7,8]

print zip(L1,L2)

for (x,y) in zip(L1, L2):
     print x, y, '--', x+y


           
       








Related examples in the same category

1.Generator ExpressionsGenerator Expressions
2.Loop over two or more sequences at the same timeLoop over two or more sequences at the same time
3.Zip a two listsZip a two lists
4.Zip three tuplesZip three tuples
5.Difference between zip and mapDifference between zip and map
6.Zip function demo: returns a list of tuplesZip function demo:  returns a list of tuples