(score, credit_hours) tuples. Write weighted_average(grades) that returns the credit-hour-weighted average score, rounded to 2 decimal places. Assume the total credit hours is greater than 0.grades = [(90, 3), (80, 4), (70, 2)]
81.11
(90*3 + 80*4 + 70*2) / (3+4+2) = 730/9 = 81.11 (rounded).
Accumulate weighted_sum += score * hours and total_hours += hours in one pass, then divide.