Basic elementwise addition
Input
add_lists([1, 2, 3], [4, 5, 6])
Output
[5, 7, 9]
1+4, 2+5, 3+6 => [5,7,9]
Full lesson preview
Use map and a lambda to add two lists elementwise, returning a list of sums up to the shortest input.
Problem statement
Task
Examples
Input
add_lists([1, 2, 3], [4, 5, 6])
Output
[5, 7, 9]
1+4, 2+5, 3+6 => [5,7,9]
Input format
Output format
Constraints
Samples
Input
add_lists([1, 2], [10, 20, 30])
Output
[11, 22]
Only the first two pairs are summed.