def split(arr: "list", batch: "int") -> "list[list]": size = len(arr) if size <= batch: return [arr] step = size // batch res = [arr[i * batch: (i + 1) * batch] for i in range(step)] if size % batch: res.append(arr[step * batch:]) return res if __name__ == '__main__': ll = list(range(1, 29)) print(ll) print(split(ll, 50))