I am trying to figure out a way to find whether all the integers in my list are increasing sequentially. If any numbers are non-sequential I want to get the index.
mylist = [1,2,3,2]
So, is 2 more than 1 (yes), is 3 more than 2 (yes), is 2 more than 3(no, get index).
I can compare an unsorted list against a sorted list to work out if it is sequential, but I also want to establish the index. Is there a way to do this?
Thanks Toby
I guess you are looking for something like this:
>>> mylist = [1,2,3,2,3,5,6,3,7,8,6]
>>> [i+1 for i in range(len(mylist)-1) if mylist[i]>mylist[i+1]]
[3, 7, 10]