Cody

# Problem 44156. Weighted average

Solution 2086507

Submitted on 10 Jan 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
A = [10 15 20 10]; W = [ 1 1 1 1]; Y = 13.75 assert(isequal(weighted_average(A,W),Y))

Y = 13.7500

Unrecognized function or variable 'w'. Error in weighted_average (line 2) y =(x*w.')/length(x) Error in Test1 (line 4) assert(isequal(weighted_average(A,W),Y))

2   Fail
A = [ 10 15 20 10]; W = [0.25 0.25 0.25 0.25]; Y = 13.75 assert(isequal(weighted_average(A,W),Y))

Y = 13.7500

Unrecognized function or variable 'w'. Error in weighted_average (line 2) y =(x*w.')/length(x) Error in Test2 (line 4) assert(isequal(weighted_average(A,W),Y))

3   Fail
A = [10 15 20 10]; W = [ 2 4 4 2]; Y = 15 assert(isequal(weighted_average(A,W),Y))

Y = 15

Unrecognized function or variable 'w'. Error in weighted_average (line 2) y =(x*w.')/length(x) Error in Test3 (line 4) assert(isequal(weighted_average(A,W),Y))

4   Pass