Created
February 21, 2014 23:23
-
-
Save townie/9145748 to your computer and use it in GitHub Desktop.
I love 1 liners
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
cuz_i_am_lazy= %w(75 | |
100 | |
85 | |
65 | |
84 | |
87 | |
95) | |
score= cuz_i_am_lazy.map{ |x| x.to_i} | |
puts score.inject(){|sum, value| sum + value} / score.length | |
puts score.minmax_by { |x| x} |
Otherwise, great job!
Thanks man! I really appreciate it
Also, use .to_f instead of to_i, it's more accurate.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
your score variable is an array, I'd call it scores so it's more expressive.