I'm trying to create a cartesian product list of all possible combinations between two lists, made from a master list. But passing the "master_list" into the cartesian product function.
I want the results:
(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (1, 0) (1, 1) (1, 2) (1, 3) (1, 4)
x = [0,1]
y = [0,1,2,3,4]
This works (below) in displaying desired results:
mylist = list(itertools.product(x, y))
However, this doesn't work (below), and this is what I really need. The "master_list" list might be comprised of multiple lists dynamically. What am I missing here?:
master_list = [x, y]
mylist = list(itertools.product(master_list))
The list "master_list" is being created dynamically within the code, so I can't type something like this below. This example also works to show what I need.
mylist = list(itertools.produuct(master_list[0], master_list[1]))