The file scores.txt contains a series of scores from someone’s attempt at an activity over time. Plot the scores as a running sum line plot.
In a running sum line plot, rather than plotting the values directly, you plot the sum of the points over time. You can achieve this by combining the Sum pattern with the Map pattern: each iteration, you calculate the current sum and append that value to the list.
Title the graph "Score over Time", label the X-axis as "Time", and the Y-axis as "Score". Call plt.show() to display the plot.
Note that you will also need to open the file, process it line-by-line, and convert each value to an integer using the int function.
You’ll know if the plot is correct if it’s a nice wavy line that slowly increases over time. If it is a jagged, spiky line, then you are probably plotting the values directly instead of the running sum!
The file is in scores.txt and in the scores.txt tab of the sandbox (To sandbox). Run your program there (Run) to see the plot.
The first lines of scores.txt:
3
2
2
2
2
2
2
1
...