Cody

# Problem 2643. Find out base of following arithmetic operation

Solution 3065656

Submitted on 5 Oct 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
x = '41/3=13'; y_correct = 8; assert(isequal(base_exp(x),y_correct))

t = '41/3' ans = 13.6667 l = [] ans = 1×3 cell array {'41'} {'3'} {'13'}

Output argument "y" (and maybe others) not assigned during call to "base_exp". Error in Test1 (line 3) assert(isequal(base_exp(x),y_correct))

2   Fail
x = '23+44+14+32=223'; y_correct = 5; assert(isequal(base_exp(x),y_correct))

t = '23+44+14+32' ans = 113 l = [] ans = 1×5 cell array {'23'} {'44'} {'14'} {'32'} {'223'}

Output argument "y" (and maybe others) not assigned during call to "base_exp". Error in Test2 (line 3) assert(isequal(base_exp(x),y_correct))

3   Fail
x = '41^(1/2)=5'; y_correct = 6; assert(isequal(base_exp(x),y_correct))

t = '41^(1/2)' ans = 6.4031 l = [] ans = 1×4 cell array {'41'} {'1'} {'2'} {'5'}

Output argument "y" (and maybe others) not assigned during call to "base_exp". Error in Test3 (line 3) assert(isequal(base_exp(x),y_correct))

4   Fail
x = '302/20=12.1'; y_correct = 4; assert(isequal(base_exp(x),y_correct))

t = '302/20' ans = 15.1000 l = [] ans = 1×4 cell array {'302'} {'20'} {'12'} {'1'}

Output argument "y" (and maybe others) not assigned during call to "base_exp". Error in Test4 (line 3) assert(isequal(base_exp(x),y_correct))

5   Fail
x = '6*9=42'; y_correct = 13; assert(isequal(base_exp(x),y_correct))

t = '6*9' ans = 54 l = [] ans = 1×3 cell array {'6'} {'9'} {'42'}

Output argument "y" (and maybe others) not assigned during call to "base_exp". Error in Test5 (line 3) assert(isequal(base_exp(x),y_correct))

### Community Treasure Hunt

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

Start Hunting!