Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Goes Right After solution in Uncategorized category for Goes Right After (simplified) by Kacper_Kaszuba
def goes_after(word: str, first: str, second: str) -> bool:
if (first in word) and (second in word):
ind1 = word.index(first)
ind2 = word.index(second)
if ind1 != len(word)-1:
return word[ind2] == word[ind1+1]
return False
print("Example:")
print(goes_after("world", "w", "o"))
# These "asserts" are used for self-checking
assert goes_after("world", "w", "o") == True
assert goes_after("world", "w", "r") == False
assert goes_after("world", "l", "o") == False
assert goes_after("list", "l", "o") == False
assert goes_after("", "l", "o") == False
assert goes_after("list", "l", "l") == False
assert goes_after("world", "d", "w") == False
print("The mission is done! Click 'Check Solution' to earn rewards!")
Dec. 12, 2022