I must modify the function gp so it will handle + and - grades by adding or subtracting 0.3 points. For example, a B + is worth 3.3 points, and a C- is 1.7 points.
Example.
>>> gp('A-')
3.7
>>>gp('B+')
3.3
The suggestion is I could just add a bunch of elif clauses to test each grade separately, but a similar design is to use a call to s.startswith to figure out the value of the letter grade, then use s.endswith to see if you should add or subtract 0.3 points.
So far this is what I have.
def gp(s):
A = 4
return A
B = 3
return B
C = 2
return C
D = 1
return D
F = 0
return f