Skip to content

Instantly share code, notes, and snippets.

View bootcoder's full-sized avatar

Hunter Chapman bootcoder

View GitHub Profile
// pseudo for u1_w2_c5.js
//
// write 3 functions to calculate the sum, mean and median of even and odd arrays
// create variable total and set equal to 0
//
// Sum
// create a function sum, that takes a single input as an argument.
//
@bootcoder
bootcoder / gist:9405030
Created March 7, 2014 04:01
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"