Weighted average
Returns the weighted average of two or more numbers.
- Use
sum()
to sum the products of the numbers by their weight and to sum the weights. - Use
zip()
and a list comprehension to iterate over the pairs of values and weights.
Returns the weighted average of two or more numbers.
sum()
to sum the products of the numbers by their weight and to sum the weights.zip()
and a list comprehension to iterate over the pairs of values and weights.