n: int = None, prefix=None):
n = n if n !=None else len(l)
if prefix is None:
prefix = []
if n == 0:
print(prefix)
for num in l:
if num in prefix:
continue
prefix.append(num)
generate_permutations(l,n-1,prefix)
prefix.pop()
from itertools import permutations
yield ;-)
for sub in generate_permutations(...): yield prefix + sub
Обсуждают сегодня