I have a list of values. Now I want to subtract the values in list with the previous values while ignoring the subtraction for the first index value. Although I did it, It's not appending the first index value into the newly created list. How do I append the first index value into the list?
list1 = [269.76666, 284.1666, 309.45, 357.21666666666664, 393.8833333333333, 443.81666666666666]
diffs = [y - x for x, y in zip(list1 , list1 [1:])]
Output displayed:-
[14.399940000000015,
25.283399999999972,
47.76666666666665,
36.666666666666686,
49.93333333333334]
Execpted output:-
[269.76666,
14.399940000000015,
25.283399999999972,
47.76666666666665,
36.666666666666686,
49.93333333333334]