Ad
  • Custom User Avatar

    I'm assuming that this is in python. We're going to use the example you are having issues with to help understand what's going wrong. The word you are failing is Test.

    There are 2 things wrong with your code:

    1. The if/else statement in the first line doesn't do anything. It can be completely removed.

    2. The last line has return s[evenslice:slicelen]. In other words it is: return s[PositionLeftOfCenter:PositionCenter]. So in our example test, this would be return s[1,2]. Now that may look good, but you have to remember that when slicing an array the lower bounds are inclusive, and the upper bounds are exclusive. So our example s[1,2] would return what's in position 1, but not 2. In other words, it would return e. So to get it to also return the s, you'll need to use s[evenslice:slicelen+1].

    Let me know if you are still having issues. I ran your code with the above changes and everything runs fine.