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
| // 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. | |
| // |
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
| 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" |
NewerOlder