You can write a loop that goes over the values x–5, ..., x+5, except those that are outside the range 0–99, for example like this:

for x_new in range(max(0, x-5), min(99, x+5))
If any one of the h[x_new] values is higher than h[x], you can update x to x_new and repeat the same loop again to keep going up.