Comprehensions and functional programming · 13 / 15 Exercise Medium

Adding lists with zip

Objective

Create a Python program that combines two lists element by element with zip.

Instructions

  • Read two lines with integers separated by spaces. Both have the same amount of numbers.
  • On the first line show Sum: followed by the sum of each pair of numbers (first with first, second with second...), separated by a space.
  • On the second line show Dot product: P, where P is the sum of the products of each pair.
Input
1 2 3
4 5 6
Output
Sum: 5 7 9
Dot product: 32

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise