a=[1,2,3]
b=[4,5,6]
zip(a,b)
print(list(zip(a,b)))#[(1, 4), (2, 5), (3, 6)]
for i,j in zip(a,b):
print(i/2,j*2)
print(list(zip(a,a,b)))#[(1, 1, 4), (2, 2, 5), (3, 3, 6)]
function=lambda x,y:x+y
print (function(2,3)) #5
def func1(x,y):
return x+y
dem=map(func1,[1,3],[2,4])
print(list(dem)) #[3, 7]
输出:
[(1, 4), (2, 5), (3, 6)]
(0, 8)
(1, 10)
(1, 12)
[(1, 1, 4), (2, 2, 5), (3, 3, 6)]
5
[3, 7]