You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
382 B
Plaintext

10 years ago
a=set([1,2,3,4])
b=set([4,5,6,7])
c=set([7,8,9])
10 years ago
def array_combinations(*args):
10 years ago
combinations = [[i] for i in set(args[0])]
10 years ago
for arg in args[1:]:
tempcomb = []
10 years ago
for i in set(arg):
10 years ago
tempcomb += [c+[i] for c in combinations if i not in c ]
combinations = tempcomb
return combinations
res = array_combinations(a,b,c)
10 years ago
print res
10 years ago
print len(res)