+ 1

python heelp

how easy add two lists. I have: tab1=[1,2,3,5,6] and tab2=[3,4,5,7,2] and tab 3 = [(tab1[0]+tab2[0]),(tab1[1]+tab2[1])....... ]

14th Nov 2018, 8:04 PM
Kasia Herasymenko
Kasia Herasymenko - avatar
2 Respuestas
+ 3
Found this somewhere: tab3 = list(map(lambda n1, n2: n1+n2, tab1, tab2)) print(tab3) Link: https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/methods/built-in/map
14th Nov 2018, 8:28 PM
Paul
Paul - avatar
+ 1
thank you so much. Works fine
14th Nov 2018, 8:32 PM
Kasia Herasymenko
Kasia Herasymenko - avatar