Return the weighted average of 1-D array x using weights, i.e. sum(x * weights) / sum(weights).
x
weights
sum(x * weights) / sum(weights)
Input
x = [1. 2. 3. 4.] weights = [1 2 3 4]
Output
np.float64(3.0)
This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.
solve(...)