If there is a list A = [1, 4, 10] I want to change the list A into A = [1, 3, 6] where:
1would stay the same,4would be4 - 1 = 3,10would be10 - 4 = 6
How can I do this? So far, I have done
A = [1, 4, 10]
for i, num in enumerate(A):
if i == 0:
A[i] = A[0]
else:
A[i] = A[i] - A[i-1]
print(A)
but the printed A would be [1, 3, 7]