mirror of
https://github.com/balkian/gists.git
synced 2024-11-21 17:22:29 +00:00
This commit is contained in:
parent
f191ccf557
commit
ba4bb85a92
@ -1,10 +1,11 @@
|
|||||||
def array_combinations(*args):
|
def array_combinations(*args):
|
||||||
combinations = [[i] for i in args[0]]
|
combinations = [[i] for i in set(args[0])]
|
||||||
for arg in args[1:]:
|
for arg in args[1:]:
|
||||||
tempcomb = []
|
tempcomb = []
|
||||||
for i in arg:
|
for i in set(arg):
|
||||||
tempcomb += [c+[i] for c in combinations if i not in c ]
|
tempcomb += [c+[i] for c in combinations if i not in c ]
|
||||||
combinations = tempcomb
|
combinations = tempcomb
|
||||||
return combinations
|
return combinations
|
||||||
res = array_combinations(a,b,c)
|
res = array_combinations(a,b,c)
|
||||||
|
print res
|
||||||
print len(res)
|
print len(res)
|
Loading…
Reference in New Issue
Block a user