• Additional test case needed for Goes Right After

Question related to mission Goes Right After

 

tl;dr

The mission "Goes Right After" needs to have the following test case added:

goes_after('world', 'x', 'w') == False

The reason is

One of the conditions for this mission is: [If] one of the symbols are not in the given word - your function should return False;

However, this condition is only ever tested on the second symbol. Because this condition is never tested on the first symbol, many of the accepted solutions are some variation of:

def goes_after(word: str, first: str, second: str) -> bool:
    return word.find(first) + 1 == word.find(second)

But, because str.find() returns -1 , these solutions will erroneously return:

>>> goes_after('world', 'z', 'w')
True

The addition of this simple test case would correct the issue and improve the overall learning experience of the mission.

25