Write a program or a function in your favorite programming language that will take as input a number n (integer or non-integer) between 0 and 100 inclusive, and output the corresponding grade as outlined below:

• If 0 < n <= 40, then output E.
• If 40 < n <= 55, then output D.
• If 55 < n <= 65, then output C.
• If 65 < n <= 70, then output C+.
• If 70 < n <= 75, then output B-.
• if 75 < n <= 80, then output B.
• If 80 < n <= 85, then output B+.
• If 85 < n <= 90, then output A-.
• If 90 < n <= 95, then output A.
• If 95 < n <= 100, then output A+.

You are guaranteed that there are no other cases to test, and that n is guaranteed to be within 0 and 100.

The input n can be provided via stdin or as an argument to the program.

Lines in the output are not allowed to have trailing spaces and/or newlines. You must output exactly the corresponding grade, nothing else.

Shortest code in bytes wins!

• Odd, I've never received an E grade before... Is that for ease of coding, or did you intend F? – Steven H. Aug 11 '16 at 2:05
• @StevenH. I actually do mean E there (that's how my university denotes failing grades). – Ryan Aug 11 '16 at 2:06
• Some education systems use E as the absolute lowest without an F – Quill Aug 11 '16 at 2:06
• I think we've already had a challenge to convert numbers grades to letters. – xnor Aug 11 '16 at 2:26

# Python, 7466 73 bytes

lambda n,l="E "*8+"D D D C C C+ B- B B+ A- A A+ A+":l.split()[int(n-1)/5]


Unnamed lambda, uses a list of all grades in groups of 5. (I'm sure there's a way to handle n=100 without adding the extra 'A+' at the end, I'm just not sure how)

Edit: Thanks to @LeakyNun for 8 bytes

• Question says n could be non-integer? – Neil Aug 11 '16 at 2:25
• Logically you shouldn't have to add an extra A+ at the end. This gives wrong output for 95.1 – Leaky Nun Aug 11 '16 at 2:50
• Instead of doing (n-1)/5, you can do 20-n/5 which shifts thing correctly – Leaky Nun Aug 11 '16 at 2:50
• @LeakyNun Could you post a fuller example of what you mean? Because substituting 20-n/5 still gives a bunch of weird behavior at "edge-numbers" – Theo Aug 11 '16 at 3:03
• @Theo Have a look at Neil's answer. – Leaky Nun Aug 11 '16 at 3:04

## JavaScript (ES6), 57 bytes

n=>A+ A A- B+ B B- C+ C C D D D.split [20-n/5|0]||E


# Pyth, 36 bytes

?<Q41\E+C/-1075Q15?<Q66k-@"-+ "/_Q5d


Test suite.

### Explanation

Here is the equivalent program in Python 3.

lambda Q:[chr(int(1075-Q)//15)+["-+ "[int(99-Q/5)%3],""][Q<66],"E"][Q<41].split()


Ideone it!