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 by Aleksandra_Niewiadomska
def goes_after(word, first, second):
if first not in word or second not in word:
return False
if first == second:
return False
first_index = word.index(first)
second_index = word.index(second)
return first_index < second_index and word[first_index + 1] == second
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("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
assert goes_after("Almaz", "a", "l") == False
print("The mission is done! Click 'Check Solution' to earn rewards!")
Feb. 1, 2023