Samstag, 6. April 2013

Quick permutations

itertools for python are fun:
import itertools

partb= list(itertools.imap(lambda x: "".join(x), itertools.combinations('aApe',3)))
parta = list(itertools.imap(lambda x: "".join(x), itertools.permutations('gRrAet!1',5)))

print '\n'.join(list(itertools.imap(lambda x: "".join(x), (itertools.product(parta, partb)))))
But in the end, this post is just to test out the syntax highlighting feature in javascript.