Cody

Solution 1910160

Submitted on 23 Aug 2019
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
filetext = fileread('MeanWhile.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
filetext = fileread('MeanWhile.m'); assert(isempty(strfind(filetext, 'sum')),'sum() function is forbidden')

3   Pass
filetext = fileread('MeanWhile.m'); assert(isempty(strfind(filetext, 'mean')),'mean() function is forbidden')

4   Pass
rng(1); av_correct = 5.5; assert(isequal(MeanWhile(),av_correct))

p = 4 p = 11 p = 11 average = 5.5000

5   Pass
rng(2); av_correct = 4; assert(isequal(MeanWhile(),av_correct))

p = 4 p = 4 average = 4

6   Pass
rng(3); av_correct = 5.25; assert(isequal(MeanWhile(),av_correct))

p = 6 p = 13 p = 16 p = 21 p = 30 p = 39 p = 40 p = 42 p = 42 average = 5.2500

7   Fail
rng(7); av_correct = 0; assert(isequal(MeanWhile(),av_correct))

p = 0 average = NaN

Assertion failed.

8   Pass
rng(0); av_correct = 6.571428571428571; assert(isequal(MeanWhile(),av_correct))

p = 8 p = 17 p = 18 p = 28 p = 34 p = 35 p = 38 p = 44 p = 54 p = 64 p = 65 p = 75 p = 85 p = 90 p = 98 p = 99 p = 103 p = 113 p = 121 p = 131 p = 138 p = 138 average = 6.5714