THE CHALLENGERUNNING_SUM — Add the values as you go.
You are given n integers. Print their running sums: the i-th value is the sum of the first i integers.
Input:
- line 1: the integer n
- line 2: n integers separated by spaces
Output:
the n running sums, separated by spaces.
Example:
5
1 2 3 4 5
gives
1 3 6 10 15
How to break it down:
1. somme_cumulee(tab): returns the list of running sums of tab.
2. Read n, then the n integers.
3. Print the result with print(' '.join(map(str, resultat))).
Challenge: write somme_cumulee() yourself - itertools.accumulate is not allowed.
Checks (verified automatically before your code runs):
- At least 1 function definition.
- At least 1 call to somme_cumulee().
- Do not use accumulate().
- Not allowed: imports.