I have a even list of numbers:
lst = [2,3,4,1,6,7]
I need to subtract the second number of each couple and sum the result of all couples, below the result:
out = 3-2+1-4+7-6
Is there any elegant solution? Appreciate any hints!
>>> sum(lst[1::2]) - sum(lst[::2]) -1
2.1m questions
2.1m answers
60 comments
57.0k users