Cody

Problem 44455. Find the average of a random sequance

Solution 2291993

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

Error in solution: Line: 20 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "MeanWhile".)

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

Error in solution: Line: 20 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "MeanWhile".)

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

Error in solution: Line: 20 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "MeanWhile".)

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

Error in solution: Line: 20 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "MeanWhile".)

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

Error in solution: Line: 20 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "MeanWhile".)

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

Error in solution: Line: 20 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "MeanWhile".)

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

Error in solution: Line: 20 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "MeanWhile".)

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

Error in solution: Line: 20 Column: 1 This statement is not inside any function. (It follows the END that terminates the definition of the function "MeanWhile".)

Suggested Problems

More from this Author25

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!