Exercise: more statistics - video
Exercise: more statistics
Take the script from the earlier lecture - adding the numbers that were in a file. First of all type it in and make sure it works. Then impove it so in addition to the sum it will also print out the average. What do you need in order to compute the average? Print that value too.
Also print the max and min values. Have you checked if all the values are positive numbers? What if all of them are negative?
Once you made sure everything works correctly printing to the screen, create a report file. Change your script so it will create a file containing the
report about the statistics. Something like this:
Report about file data.txt -------------------------- minumum: -17 maximum: 34 total: 126 count 6 average: 21