Your question is Weighted Average Coding. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Cornerstone Learning Experience can combine scores from multiple assessments, where each assessment contributes according to its weight. Given parallel arrays of scores and weights, calculate the weighted average of all valid scores.
A score may be None, representing a missing assessment. Ignore that score and its weight. Ignore entries whose weight is zero. The input guarantees that at least one included score has a positive weight.
Implement weighted_average(scores, weights):
scores is a list containing numbers or None.weights is a list of nonnegative numbers with the same length as scores.score * weight to the numerator.sum(score * weight) / sum(weight) as a floating-point number.def weighted_average(scores, weights):