Answer the question
In order to leave comments, you need to log in
What is the correct way to pass a list to a Python function?
Wrote a function to compose all placements without repetition.
def combinator(setOfNum,length,deep=-1,arrayOfComb=[],num=[]):
if deep == -1 : deep = length
if deep == 0:
arrayOfComb.append(copy.copy(num))
return
for i in range(setOfNum):
if num.count(i) == 0: num.append(i)
else: continue
combinator(setOfNum,length,deep-1)
del num[-1]
if deep == length:
return copy.copy(arrayOfComb)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question