Write a program that subtracts corresponding elements in two lists and prints a new list


Topic: Write a program that subtracts corresponding elements in two lists and prints a new list

Solution

list1 = [1, 2, 3, 4, 5]
list2 = [5, 4, 3, 2, 1]
diff_list = [a-b for (a,b) in zip(list1, list2)]
print(diff_list)



List all Python Programs