0

how can I find the difference between two adjant numbers in a list?

12th Sep 2017, 9:39 AM
Mai Aljuaid
Mai Aljuaid - avatar
4 Antworten
+ 11
lst = [3,2,1[ i = 0 print(lst[i]-lst[i+1])
12th Sep 2017, 9:44 AM
༼ つ ◕_◕ ༽つ
༼ つ ◕_◕ ༽つ - avatar
+ 1
Also you need to check which is biggest first and subtract smallest from biggest.
12th Sep 2017, 10:08 AM
josh mizzi
josh mizzi - avatar
0
Thanks, is there any built in function that can find the difference?
12th Sep 2017, 9:49 AM
Mai Aljuaid
Mai Aljuaid - avatar
0
Thank you!!
12th Sep 2017, 10:09 AM
Mai Aljuaid
Mai Aljuaid - avatar