I have an array that looks something like this [1000, 562, 342, 123, 32, 0]
with 0
always being the start point, the values are cumulative distances from 0.
I want to find the average distance between all the points but to get the average distance I need to minus the values in the array to the value next to it. My issue is I'm not sure how to go about getting the minus values since 0 can't minus since it's the last value in the array.
I tried a for
loop:
for x in newdata:
newdata[x] = newdata[x] - newdata[x-1]
but get an error:
TypeError: list indices must be integers or slices, not float