Created
August 22, 2013 12:51
-
-
Save radavis/6306735 to your computer and use it in GitHub Desktop.
Min, Max and Average
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
scores = [75, 100, 85, 65, 84, 87, 95] | |
p scores | |
puts "Average: #{scores.inject(0){|sum, i| sum + i} / scores.length.to_f}" | |
puts "Minimum: #{scores.min}" | |
puts "Maximum: #{scores.max}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment