Cody

Solution 1839772

Submitted on 5 Jun 2019 by maya abu fowdah
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))

y = 1 average = 4 x = 7 y = 2 average = 11 x = 0

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

y = 1 average = 4 x = 0

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

y = 1 average = 6 x = 7 y = 2 average = 13 x = 3 y = 3 average = 16 x = 5 y = 4 average = 21 x = 9 y = 5 average = 30 x = 9 y = 6 average = 39 x = 1 y = 7 average = 40 x = 2 y = 8 average = 42 x = 0

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

y = 1

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

y = 1 average = 8 x = 9 y = 2 average = 17 x = 1 y = 3 average = 18 x = 10 y = 4 average = 28 x = 6 y = 5 average = 34 x = 1 y = 6 average = 35 x = 3 y = 7 average = 38 x = 6 y = 8 average = 44 x = 10 y = 9 average = 54 x = 10 y = 10 average = 64 x = 1 y = 11 average = 65 x = 10 y = 12 average = 75 x = 10 y = 13 average = 85 x = 5 y = 14 average = 90 x = 8 y = 15 average = 98 x = 1 y = 16 average = 99 x = 4 y = 17 average = 103 x = 10 y = 18 average = 113 x = 8 y = 19 average = 121 x = 10 y = 20 average = 131 x = 7 y = 21 average = 138 x = 0