Read the question, write Python on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read two lines of integers of equal length. Print the pairwise sums, space-separated.
zip(a, b) walks both lists in lockstep — the iterator that pairs things up.
Input. Two lines, each space-separated integers of the same length.
Output. The pairwise sums, space-separated.
Examples
Input
1 2 3 10 20 30
Output
11 22 33
Input
5 7
Output
12
Hint
- a = list(map(int, input().split())) — same for b.
- print(*[x + y for x, y in zip(a, b)]).
Show correct code
Peek only after you have tried. You can still Check your own version.
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(*[x + y for x, y in zip(a, b)])
main.pyPython · Ctrl + Enter runs
ResultIdle
Run to see output. Check grades the tests.