Write a function that outputs True if the letters in it are one after the other in the string, and False otherwise. def goes_after(word: str, first: str, second: str) -> bool: s = '' for i, let in enumerate(word): print (let[i] + let[i+1]) print(first + second) if let[i] + let[i-1] == first + second: return True else: return False Examples: goes_after("world", "o", "r") Result: True goes_after("world", "w", "r") Result: False
def goes_after(word, first, second): for i in range(len(word) - 1): if word[i] == first and word[i+1] == second: return True return False