Answers for "python add two lists in a loop"

1

joining two lists in python using for loop

list1 = ["a", "b" , "c"]
list2 = [1, 2, 3]

for x in list2:
  list1.append(x)

print(list1)
Posted by: Guest on December-29-2021
1

python add elements of two lists together

list1 = [1, 2, 3]
list2 = [4, 5, 6]
sum_list = []

for (item1, item2) in zip(list1, list2):
	sum_list.append(item1 + item2)

print(sum_list)
Posted by: Guest on November-28-2020

Code answers related to "python add two lists in a loop"

Python Answers by Framework

Browse Popular Code Answers by Language