I've tried the assert in MATLAB on my desktop and it doesn't throw an error... so I'm not really sure where it's gone wrong here. I'm guessing it's something tiny I've missed. Any help?
Which version of MATLAB are you using on your desktop? I tried running your solution on MATLAB desktop version 2019a and the solution is failing with correct assertions. In order to figure out the version of MATLAB, command "ver' will get you the version.
The version of matlab is not going to affect the result. This solution removes punctuation from the input, so the '.' at the end of sentence in the second test is incorrectly removed.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
sIn = 'hello'
sOut = 'hlleo'
assert(isequal(scrambleText(sIn),sOut))
sIn =
'hello'
sOut =
'hlleo'
|
2 | Fail |
sIn = 'This is the first time I have used MATLAB.'
sOut = 'Tihs is the fsrit tmie I hvae uesd MALTAB.'
assert(isequal(scrambleText(sIn),sOut))
sIn =
'This is the first time I have used MATLAB.'
sOut =
'Tihs is the fsrit tmie I hvae uesd MALTAB.'
|
797 Solvers
191 Solvers
189 Solvers
244 Solvers
439 Solvers