I have a image_size list saved in Tuple type. I would like to check the size of heights less than 2470 pixel and make new list file and save them.
Image_size = [(800,1200), (820, 700), (850, 300), (900, 200), (760, 1900), (820, 2000),
(830, 1300), (900, 400), (300, 600), (190, 200)]
widths, heights = zip(*(Image_size))
i = 0
j = 0
while sum(heights[j:i+2]) < 2470:
i = i +1
if sum(heights[j:i+2]) > 2470:
Image_size[i] = Image_size[j:i+1]
j = i + 1
But the code has some errors so I cannot get the right result. The result value that I expect is as follows.
Image_size1 = [(800,1200), (820, 700), (850, 300), (900, 200)]
Image_size2 = [(760, 1900)]
Image_size3 = [(820, 2000)]
Image_size4 = [(830, 1300), (900, 400), (300, 600)]
Image_size5 = [(190, 200)]
the number of Image_size should be created automatically.