Cody

# Problem 44455. Find the average of a random sequance

Solution 1910152

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

r = 4 t = 4 r = 7 t = 4 7 r = 0 t = 4 7 0 t = 4 7 0

Output argument "average" (and maybe others) not assigned during call to "MeanWhile". Error in Test4 (line 3) assert(isequal(MeanWhile(),av_correct))

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

r = 4 t = 4 r = 0 t = 4 0 t = 4 0

Output argument "average" (and maybe others) not assigned during call to "MeanWhile". Error in Test5 (line 3) assert(isequal(MeanWhile(),av_correct))

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

r = 6 t = 6 r = 7 t = 6 7 r = 3 t = 6 7 3 r = 5 t = 6 7 3 5 r = 9 t = 6 7 3 5 9 r = 9 t = 6 7 3 5 9 9 r = 1 t = 6 7 3 5 9 9 1 r = 2 t = 6 7 3 5 9 9 1 2 r = 0 t = 6 7 3 5 9 9 1 2 0 t = 6 7 3 5 9 9 1 2 0

Output argument "average" (and maybe others) not assigned during call to "MeanWhile". Error in Test6 (line 3) assert(isequal(MeanWhile(),av_correct))

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

r = 0 t = 0 t = 0

Output argument "average" (and maybe others) not assigned during call to "MeanWhile". Error in Test7 (line 3) assert(isequal(MeanWhile(),av_correct))

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

r = 8 t = 8 r = 9 t = 8 9 r = 1 t = 8 9 1 r = 10 t = 8 9 1 10 r = 6 t = 8 9 1 10 6 r = 1 t = 8 9 1 10 6 1 r = 3 t = 8 9 1 10 6 1 3 r = 6 t = 8 9 1 10 6 1 3 6 r = 10 t = 8 9 1 10 6 1 3 6 10 r = 10 t = 8 9 1 10 6 1 3 6 10 10 r = 1 t = 8 9 1 10 6 1 3 6 10 10 1 r = 10 t = 8 9 1 10 6 1 3 6 10 10 1 10 r = 10 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 r = 5 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 r = 8 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 r = 1 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 r = 4 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 r = 10 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 r = 8 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 8 r = 10 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 8 10 r = 7 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 8 10 7 r = 0 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 8 10 7 0 t = 8 9 1 10 6 1 3 6 10 10 1 10 10 5 8 1 4 10 8 10 7 0

Output argument "average" (and maybe others) not assigned during call to "MeanWhile". Error in Test8 (line 3) assert(isequal(MeanWhile(),av_correct))