def find_maxima(x):
    """Find local maxima of x.

    Input arguments:
    x -- 1D list of real numbers

    Output:
    idx -- list of indices of the local maxima in x
    """
    localmax = []

    for i, num in enumerate(x):
        if i == 0:
            if x[i+1] < x[i]:
                localmax.append(i)
        elif i == len(x)-1:
            if x[i-1] < x[i]:
                localmax.append(i)
        else:
            if x[i+1] < x[i] and x[i-1] < x[i]:
                localmax.append(i)

    return localmax


if __name__ == "__main__":
    x = [1, 2, 3]
    print(find_maxima(x))
