public

One line solutions (without imports) in Python2 to Lambdaheads 2012-01-09 challenge https://metalab.at/wiki/Lambdaheads

  • Download Gist
More Functional (map, fold).py
Python
1 2
from itertools import permutations
print '|'.join(map(''.join, reduce(lambda x, y: x | y, [set(permutations(("YYYY", "MM", "DD"), i)) for i in range(1,4)] + [set(permutations(("YY", "MM", "DD"), i)) for i in range(1,4)])))
gistfile1.py
Python
1 2
from itertools import permutations
print '|'.join([''.join(comb) for comb in set(list(permutations(("YYYY", "MM", "DD"))) + list(permutations(("YYYY", "MM", "DD"), 2)) + list(permutations(("YYYY", "MM", "DD"), 1)) + list(permutations(("YY", "MM", "DD"))) + list(permutations(("YY", "MM", "DD"), 2)) + list(permutations(("YY", "MM", "DD"), 1)))])

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.