Skip to content
Advertisement

How to subtract values from a list with values from the same list?

I have the following list:

JavaScript

I want to subtract the second value with the first value, the third with the second, and so on. The results I want to transfer into a new list.

The output should be

JavaScript

Advertisement

Answer

You can do this :

JavaScript

Output :

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement