Created
January 19, 2012 07:46
-
-
Save halexus/1638626 to your computer and use it in GitHub Desktop.
One line solutions (without imports) in Python2 to Lambdaheads 2012-01-09 challenge https://metalab.at/wiki/Lambdaheads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)))]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment