Exercise 3 (Advanced)

I am trying the below code. It runs but not passing the test. After every step to right(which goes up) I am checking the next 5 steps to find a new x. Is there something wrong in the logic

def climb(x, h):
    # keep climbing until we've found a summit
    summit = False

    # edit here
    while not summit:
        summit = True         # stop unless there's a way up
        if h[x + 1] > h[x]:
            x = x + 1         # right is higher, go there
            for(x_new in range (min(0,x-5),max(0,x+5))):
                if h[x_new]>h[x]:
                    x=x_new
                    summit = False    # and keep going
    return x