Cody

Solution 2097129

Submitted on 18 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   Pass
R=1:4;k=2;y_correct = 27.5; a=dont_be_mean(R,k) assert(abs(a-y_correct)<1e-10)

a = 27.5000

2   Fail
R=0:8;k=3;y_correct = 493.3125; a=dont_be_mean(R,k) assert(abs(a-y_correct)<1e-10)

Unrecognized function or variable 'ni'. Error in dont_be_mean (line 13) for j=1:ni Error in Test2 (line 2) a=dont_be_mean(R,k)

3   Fail
R=[1 2 4 6 8];k=4;y_correct = 4666.2; a=dont_be_mean(R,k) assert(abs(a-y_correct)<1e-10)

a = 777.7000

Assertion failed.

4   Fail
R=[2 8 6 7 4 5];k=1;y_correct = 5.33333333333333; a=dont_be_mean(R,k) assert(abs(a-y_correct)<1e-10)

a = 26.6667

Assertion failed.

5   Fail
R=0:9; y=0; for k=1:8 y=y+dont_be_mean(R,k); end y_correct=61042519.44444444; assert(abs(y-y_correct)<1e-3)

Unrecognized function or variable 'ni'. Error in dont_be_mean (line 13) for j=1:ni Error in Test5 (line 4) y=y+dont_be_mean(R,k);