Created
February 14, 2013 08:55
-
-
Save Stephenitis/4951430 to your computer and use it in GitHub Desktop.
Exercise: Calculating the mean of an array of numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mean(array) | |
array.reduce(:+).to_f / array.length | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment