Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Goes Right After by mu_py
def goes_after(word: str, first: str, second: str) -> bool:
try:
f_ind = word.index(first)
s_ind = word.index(second)
except ValueError:
return False
return s_ind == (f_ind + 1)
print("Example:")
print(goes_after("world", "w", "o"))
assert goes_after("world", "w", "o") == True
assert goes_after("world", "w", "r") == False
assert goes_after("world", "l", "o") == False
assert goes_after("panorama", "a", "n") == True
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!")
Sept. 2, 2022
Comments: