Calculate Stats
Your task is to process a sequence of integer numbers to determine the following statistics:
- minimum value
- maximum value
- number of elements in the sequence
- average value
For example: [6, 9, 15, -2, 92, 11]
- minimum value = -2
- maximum value = 92
- number of elements in the sequence = 6
- average value = 21.833333
If you try to calculate the statistics of an empty sequence, it should throw an exception or otherwise return immediately with the message “sequence is empty”.
Acknowledgments
This kata is described on cyber-dojo.org