Cody

# Problem 44455. Find the average of a random sequance

Solution 1383894

Submitted on 18 Dec 2017
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   Fail
rng(1); av_correct = 5.5; assert(isequal(MeanWhile(),av_correct))

Error using MeanWhile (line 2) Unable to run the 'fevalJSON' command because it calls the 'input' command, which is not supported for this product offering. Error in Test4 (line 3) assert(isequal(MeanWhile(),av_correct))

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

Error using MeanWhile (line 2) Unable to run the 'fevalJSON' command because it calls the 'input' command, which is not supported for this product offering. Error in Test5 (line 3) assert(isequal(MeanWhile(),av_correct))

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

Error using MeanWhile (line 2) Unable to run the 'fevalJSON' command because it calls the 'input' command, which is not supported for this product offering. Error in Test6 (line 3) assert(isequal(MeanWhile(),av_correct))

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

Error using MeanWhile (line 2) Unable to run the 'fevalJSON' command because it calls the 'input' command, which is not supported for this product offering. Error in Test7 (line 3) assert(isequal(MeanWhile(),av_correct))

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

Error using MeanWhile (line 2) Unable to run the 'fevalJSON' command because it calls the 'input' command, which is not supported for this product offering. Error in Test8 (line 3) assert(isequal(MeanWhile(),av_correct))