Given a set of letter grades, output the GPA (grade point average) of those grades, rounded to one decimal place.
Valid grades and their corresponding value are the following:
A = 4 grade points A- = 3.7 grade points B+ = 3.3 grade points B = 3 grade points B- = 2.7 grade points C+ = 2.3 grade points C = 2 grade points C- = 1.7 grade points D+ = 1.3 grade points D = 1 grade point D- = 0.7 grade points F = 0 grade points
The formula for GPA is simply the average of the points values of the grades. The rounding scheme used should be round half up (i.e. less than 0.05 gets rounded down to 0 and greater than or equal to 0.05 gets rounded up to 0.1). The average should be unweighted (all inputs are treated equally). Note that the same grade can show up multiple times in the input, in which case each instance of that grade should be a separate element in the average.
So for example, if the input was [A, B+, A, C-], the GPA is (4 + 3.3 + 4 + 1.7)/4 = 3.25, which rounds to 3.3.
The program should take as input the grades to be averaged using whatever format is convenient, such as a list, or a string with a delimiter of your choice. Each input grade should be a single string (i.e. the letter components and +/- shouldn't be separate inputs). You can assume the input will always contain at least one grade. Note that grades may be repeated in the input.
Output can optionally include the ".0" suffix in the event of an integer result but this is not required.
This is code golf, so shortest solution in bytes wins.
[A] => 4 [F, F, F] => 0 [D+, D-] => 1 [A, B, C, D] => 2.5 [A-, B-, C-, D-] => 2.2 [A, A-, B+, B, B-] => 3.3 [A, B+, A, C-] => 3.3 [C+, C+, A, C+] => 2.7 [A, B, F, F] => 1.8