Premium problem116. Weighted Average

Easy Locked

Return the weighted average of 1-D array x using weights, i.e. sum(x * weights) / sum(weights).

Input

x = [1. 2. 3. 4.]
weights = [1 2 3 4]

Output

np.float64(3.0)

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)