Created
November 16, 2013 01:00
-
-
Save faizaanshamsi/7494428 to your computer and use it in GitHub Desktop.
Provides Average, Low Score, High Score for a hardcoded list of scores.
This file contains hidden or 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_raw = [75, 100, 85, 65, 84, 87, 95] | |
scores = scores_raw.sort | |
sum = scores.inject(0) { |total, x| total + x} | |
average = sum/(scores.length) | |
puts "The Average Score is #{average}" | |
puts "The Lowest Score is #{scores.first}" | |
puts "The Highest Score is #{scores.last}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment