[Solved] How to get the cartesian product between sets in python without using loops?
[ad_1] Yes, with itertools product , map and set: >>> from itertools import product >>> A={1,2,3} >>> B={4,5,6} >>> list(map(set, product(A, B))) [{1, 4}, {1, 5}, {1, 6}, {2, 4}, {2, 5}, {2, 6}, {3, 4}, {3, 5}, {3, 6}] 1 [ad_2] solved How to get the cartesian product between sets in python without using … Read more