I am trying to find subset of consequent numbers in a list(consisting of interger)type data by using python code. but, it was not easy for me. So, I came here for advice.
Here is example. It is a part of my list. (It is kind of a observation number.)
A = [8,9,10,11,25,26,27,28,42,43,44,45,46,47,78,79,80,81,82,83,84,85,86,251,252,253,254]
And i am trying to do:
Make a list of consecutive number sets. If there are 5 consecutive number sets, 5 list should be generated and the number of list should be A1, A2, A3, A4, A5 like below.
A1 = [8,9,10,11]
A2 = [25,26,27,28]
A3 = [42,43,44,45,46,47,48]
A4 = [78,79,80,81,82,83,84,85,86]
A5 = [251,252,253,254]
How can i do this with python code(by only using built-in function)
the characteristics of this list A is:
- the order of numbers is always ascending.
- there is no regularity like sequence. it is just a result of removing some numbers which has a problem in observing result.
please help me..