Look at this line in the loop:
difference = difference[i+1] - difference[i]
Here, you set the variable difference
to an integer. So, on the second loop, you try to index an integer. Eg, you try to say that difference = 1[2] - 1[1]
, which makes no sense whatsoever. This is what the error "Integer is not subscriptable" means.
You need to make a new list, which is what the list comprehension does before changing your variable. That's why it doesn't give a type error.
I think your code should be:
for i in range(len(difference)-1):
difference[i] = difference[i+1] - difference[i]
difference = difference[:-1] # drop last element.