Since your input is sorted, you can do it in one go with itertools.groupby :
from itertools import groupby [list(g) for _,g in groupby(numbers, lambda x: x//10)] Out[3]: [[2, 8], [13, 15], [24, 26]]
There is no need to initialize a bunch of lists in this way, groupby gives them on the fly.
This may be one after another in terms of how you wanted to handle modulo 10 boundaries; if unclear, you can always define your own grouper function:
def grouper(x): '''bins matching the semantics: [0,10] (10,20] (20, 30]''' return (x-1)//10 if x > 0 else 0
and use it like this:
numbers = [2,8,13,15,24,30] [list(g) for _,g in groupby(numbers, grouper)] Out[5]: [[2, 8], [13, 15], [24, 30]]
source share