Cody

Solution 1842519

Submitted on 8 Jun 2019 by lishai avraham
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))

count = 0 average = 0 a = 4 count = 1 average = 4 a = 7 count = 2 average = 11 a = 0 average = 5.5000

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

count = 0 average = 0 a = 4 count = 1 average = 4 a = 0 average = 4

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

count = 0 average = 0 a = 6 count = 1 average = 6 a = 7 count = 2 average = 13 a = 3 count = 3 average = 16 a = 5 count = 4 average = 21 a = 9 count = 5 average = 30 a = 9 count = 6 average = 39 a = 1 count = 7 average = 40 a = 2 count = 8 average = 42 a = 0 average = 5.2500

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

count = 0 average = 0 a = 0 count = 1 average = 0

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

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

Suggested Problems

More from this Author25