Note that the import statement is omitted in the following screenshots:
-
The mean(data) function returns the normal average of a sequence or iterator:
-
- The line 3 is the mean of integers.
- The line 4 is the mean of floats.
- The lines 6 and line 8 show that fractions can be averaged, as well as decimals.
- The harmonic_mean(data) function returns the harmonic average of a sequence or iterator. The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of the argument and is typically used when the average of rates or rations is needed.
For example, if a car traveled for a given distance at 60 mph, then ...