Running Total
Completed
Read a line of integers and print the running (cumulative) totals.
Input
One line of space-separated integers.
Output
One line, e.g. 1 3 6 10 for 1 2 3 4.
Example
Input
1 2 3 4
Output
1 3 6 10
Editor
Python
Hints
Keep a running total and append it after each addition.
Solution explanation
itertools.accumulate does this for you (Standard Library chapter).
Show solution
total = 0
result = []
for x in map(int, input().split()):
total += x
result.append(total)
print(*result)