1
0
mirror of https://github.com/balkian/gists.git synced 2024-11-21 17:22:29 +00:00
gists/Array combinations
J. Fernando Sánchez ba4bb85a92
2014-02-24 03:31:13 -08:00

11 lines
333 B
Plaintext

def array_combinations(*args):
combinations = [[i] for i in set(args[0])]
for arg in args[1:]:
tempcomb = []
for i in set(arg):
tempcomb += [c+[i] for c in combinations if i not in c ]
combinations = tempcomb
return combinations
res = array_combinations(a,b,c)
print res
print len(res)