Write a function that receives 3 assignment grades, a1, a2, a3, and a final grade, f, for a student and returns the corresponding letter grade of the student. The weights for the assignments and the final are 0.2, 0.2, 0.2, and 0.4, respectively. You can use the following table for matching grades to letters:
PYTHON!!!
Write a function that receives 3 assignment grades, a1, a2, a3, and a final grade, f, for a student and returns the corresponding letter grade of the student. The weights for the assignments and the final are 0.2, 0.2, 0.2, and 0.4, respectively. You can use the following table for matching grades to letters:
95-100 -> A1
90-94 -> A2
85-89 -> A3
80-84 -> B1
75-79 -> B2
70-74 -> B3
65-69 -> C1
60-64 -> C2
55-59 -> C3
40-54 -> D
0-39 -> F
For example, compute_letter(80, 60, 40, 70) returns "C2" because 80 * 0.2 + 50 * 0.2 + 40 * 0.2 + 70 * 0.4 = 62 and 62 corresponds to C2. Note that, you are expected to do rounding. For example, 39.4 is F, whereas 39.5 is D. You can use the builtin round() function for this. Please google this function and learn how to use it.
"""
def compute_letter(a1, a2, a3, f):
Step by step
Solved in 2 steps with 2 images