Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python consecutive numbers difference between

[y-x for x, y in zip(A[:-1], A[1:])] 

>>> A = [1, 10, 100, 50, 40]
>>> [y-x for x, y in zip(A[:-1], A[1:])]
[9, 90, -50, -10]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #consecutive #numbers #difference
ADD COMMENT
Topic
Name
4+2 =