• Check if a value is in the next index

def goes_after(word: str, first: str, second: str) -> bool:

    the_list = list(word)

    if len(the_list) == 0:
        return False
    elif first in the_list[0] and second in the_list[1]:
        return True
        return False

This is a bit of code to check if the "first" and the "second" is in the [0] position and [1] position in a list.

Now im trying to find a solution to check if the "second" is the next index after the "first".

i was thinking to add something like:

if second == the_list[first + 1]: return True

but dont really find a solution to write this code without getting error messages. But i think this could be a solution to my problem.