Skip to content

Instantly share code, notes, and snippets.

@bootcoder
Created March 7, 2014 04:01
Show Gist options
  • Select an option

  • Save bootcoder/9405030 to your computer and use it in GitHub Desktop.

Select an option

Save bootcoder/9405030 to your computer and use it in GitHub Desktop.
get_grade inject
def get_grade(array)
average = array.inject(:+).to_f / array.length
case average
when 0..59
"F"
when 60..69
"D"
when 70..79
"C"
when 80..89
"B"
when 90..100
"A"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment