m = 0 while m <len (pos_1): yes pos_1[m] == 1 + pos_1[m - 1] or pos_1[m] == pos_1[m + 1] - one: print (pos_1[m]) yes pos_1 - one! = Pos_1: break print (pos_1)
that's what my code looks like, PD: it's part of a larger code, that's why there is not a function and a call.
If I have a list like [1, 2, 3, 4, 9, 10]… I want Python to go through the list, check the consecutive number and break it when it reaches one that is not consecutive but continues later.
So the output should be:
1, 2, 3, 4