Click here to Skip to main content
15,845,681 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
how to make the result of this be [2,5,10,5.5]

What I have tried:

lst = [1,2,3,4]
lst1 = [1,3,7,1.5]
Updated 26-Jul-22 5:35am

1 solution

Use the zip function[^]:
final_list = [sum(value) for value in zip(lst, lst1)]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900