Exercise: Statistics
Now that you've learned about subroutines, you should begin to see the benefits of encapsulating code in self-contained subroutines. They provide code that can be easily reused. In this exercise, three subs provide some analysis on groups of numbers.
Just to refresh your memory from school, the mean, also called an arithmetic mean or average, of a set of numbers is simply the sum of all the numbers in the set divided by how many numbers there are in the set. The median is the number that would be in the middle if you were to sort the set numerically; with an even number of elements, the median is the average of the two numbers that would be in the middle. The standard deviation gives an idea of how “bunched” the numbers are ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access