I've these two lists a = [1, 2, 3]
and another b = [4, 2, 1]
I want this outcome by join these list like this (items in a with every item of b) :
(1, 4) (1, 2) (1, 1)
(2, 4) (2, 2) (2, 1)
(3, 4) (3, 2) (3, 1)
I've these two lists a = [1, 2, 3]
and another b = [4, 2, 1]
I want this outcome by join these list like this (items in a with every item of b) :
(1, 4) (1, 2) (1, 1)
(2, 4) (2, 2) (2, 1)
(3, 4) (3, 2) (3, 1)
For generating the cartesian product:
cart_prod = [(i, j) for i in a for j in b]
EDIT the question changed
>>> for i in a:
... print([(i, j) for j in b])
...
[(1, 4), (1, 2), (1, 1)]
[(2, 4), (2, 2), (2, 1)]
[(3, 4), (3, 2), (3, 1)]