質問

     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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top