Mar-04-2018, 08:26 AM
(This post was last modified: Mar-04-2018, 08:29 AM by Gribouillis.)
Here is a version that works with the new specs
import itertools as it def foo(names, k): n = len(names) for t in it.product(range(n), repeat=k): yield [names[x % n] for x in it.accumulate(t)] names=["Jack","Jeni","Monsa","Mehus","Kuis","Tim","Tony","Yestgf","Pere"] for x in foo(names, 4): print(' '.join(x))