l = [] for i in range(44): l.append(i) mystep = 6 ll, r = [], [] for i in range(len(l)): print(i) if i < mystep: ll = l[0:i] else: ll = l[i - mystep:i] r.append(ll) del r[0] r.append([i for i in l[-mystep:]])