Created
December 28, 2012 19:13
-
-
Save kmandreza/4400991 to your computer and use it in GitHub Desktop.
Create a method get_grade that accepts an average in the class and returns the letter grade as a String. It should only return one of 'A', 'B', 'C', etc. Don't worry about + and - grades. For example, get_grade(89) # => returns "B", *not* "B+"
get_grade(70) # => returns "C"
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(num) | |
if num >= 90 | |
return "A" | |
end | |
if num >= 80 && num <= 89 | |
return "B" | |
end | |
if num >= 70 && num <= 79 | |
return "C" | |
end | |
if num >= 60 && num <= 69 | |
return "D" | |
end | |
if num <= 59 | |
return "F" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment