1

I am trying to convert a list that only contains integers into a nested list. The number of elements in each sub-list within the nested list should be a minimum of one.

Input

input_list = [15281, 15285, 15289, 15282, 15286, 15290, 15283, 15287, 15284, 15288, 14590, 14591, 14592]

Expected output

output_list = [[15281, 15285, 15289], [15282, 15286, 15290], [15283, 15287, 15284], [15288, 14590, 14591], [14592] ]

Is there a way to achieve this without converting all integers in the input list to strings before building the nested list?

Michael S.
  • 3,050
  • 4
  • 19
  • 34

0 Answers0