TZ boy
JF-Expert Member
- Jan 11, 2012
- 628
- 183
what is exactly difference between zip() and map() in python it seems to brig the same answer when u execute block one and block two codes ? some one can tell me in simple way so that i can understand more about this two function ?
L1 = (1, 3, 4, 6)
L2 = (3, 5, 6, 2)
// block one
print zip(L1, L2)
for (x, y) in zip(L1, L2):
print x, y, '=', x + y
// block two
print map(None, L1, L2)
for (z, t) in map(None, L1, L2):
print z, t, '=', z + t
L1 = (1, 3, 4, 6)
L2 = (3, 5, 6, 2)
// block one
print zip(L1, L2)
for (x, y) in zip(L1, L2):
print x, y, '=', x + y
// block two
print map(None, L1, L2)
for (z, t) in map(None, L1, L2):
print z, t, '=', z + t