I have a list:
a = [0, 4, 10, 100]
I want to calculate difference between consecutive elements in list. I do this:
[x - a[i-1] for i, x in enumerate(a)]
But it brings me this result:
[-100, 4, 6, 90]
As you see first element is -100, but I want to keep first element unchanged, when I make such transformation to get this [0, 4, 6, 90]
. How to do that?