You can try this to get the Cartesian product.
import itertools
rowlists = [[1,5,9],[2,6,10],[3,7,11],[4,8,12]]
for combination in itertools.product(*rowlists):
print combination
سؤال
Choice1 Choice2 Choice3
A 1 5 9
B 2 6 10
C 3 7 11
D 4 8 12
How can i generate all possible combinations that include one choice for each row in python?
المحلول
You can try this to get the Cartesian product.
import itertools
rowlists = [[1,5,9],[2,6,10],[3,7,11],[4,8,12]]
for combination in itertools.product(*rowlists):
print combination