Create a list of differences from another list

Hello, I take the liberty of asking the community for a problem when calculating the differences between each number in a list:

Take for example times that are stored in a list:

List 1 with only single digits:
List1 = (76,78,79,80,82).

The output in label1 is (2,1,1,2) which corresponds well to the difference between (item2 78-item 1 76), (item3 79-78 item2), (item4 80-item 3 79), ( item5 82-item 4 80).

I added a condition to say not to do the calculation if the analysis is done on item 1 and to prevent AI2 from going looking for item 0 which does not exist! It seems to work ... but ...

When I change the list with identical values, it doesn't work.

For example, List 2: (76,79,79,80,82)
Output in label1: (3,3,1,2) which is wrong , I should have (79-76 = 3, 79-79 = 0.80-79 = 1.82-80 = 2) >>> (3,0,1,2)

If I make a new list (76,79,79,79,82) I have (3,3,3,3) instead of (3,0,0,3)

Thanks for reading this post and thanks in advance if you have a solution to this issue ...
Good day
Cedric

Use the for each number block and work through both lists using indexes. This helps to overcome duplicate entries.

Thanks Tim for this tip! I'm posting the code if that helps ...

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.