I have 3 lists of different size.
A=[1500,1000,500]
B=[159,179]
C=[6,9,12,18]
I want it to multiply and get 24(AxBxC) lists like
[[1500,159,6],[1000,159,9],[500,159,12],[1500,159,18],.....[500,179,18]]
I have 3 lists of different size.
A=[1500,1000,500]
B=[159,179]
C=[6,9,12,18]
I want it to multiply and get 24(AxBxC) lists like
[[1500,159,6],[1000,159,9],[500,159,12],[1500,159,18],.....[500,179,18]]
Seems like you want the cartesian product of the three lists. You can use itertools.product
:
from itertools import product
my_lists = [A,B,C]
[i for i in product(*my_lists)]
[(1500, 159, 6),
(1500, 159, 9),
(1500, 159, 12),
(1500, 159, 18),
(1500, 179, 6),
(1500, 179, 9),
(1500, 179, 12),
(1500, 179, 18),
(1000, 159, 6),
(1000, 159, 9),
...