Jan-27-2019, 10:13 PM
Based on the expected values from the screenshots, the loop is expected to stop once "z" has been found. The first test expects "['c',...'r']" and 'r' is the last value prior to "z". Likewise, the second test expects "['zoo...azz']" and the only string in the list ending in "azz" is "pizzazz" which is immediately before "z".
Skipping "z" and appending the remaining the values would cause those first two tests to fail. Plus, the conditional is true if a "z" is in the string, but that is not true based on test 1. You want to test equality to "z" instead.
Also, there's a problem with your index too. If "z" is found, your function increments index by 2 - once under the conditional and once again after the conditional.
Skipping "z" and appending the remaining the values would cause those first two tests to fail. Plus, the conditional is true if a "z" is in the string, but that is not true based on test 1. You want to test equality to "z" instead.
Also, there's a problem with your index too. If "z" is found, your function increments index by 2 - once under the conditional and once again after the conditional.