Created
March 24, 2016 04:19
-
-
Save Scinawa/760c7461c9d3c9100bfc to your computer and use it in GitHub Desktop.
function from N to X
This file contains 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
>>> x = len("ABCDEF") # x= 6, | |
>>> n=3 | |
>>> for i in product("ABCDEF", repeat=n): | |
... print(i) | |
('A', 'A', 'A') | |
... | |
('F', 'F', 'F') | |
>>> len( [i for i in product("ABCDEF", repeat=n)] ) == x**n | |
True | |
def sample_function(n=0, s=set() ): | |
f = {i:random.choose(s) for i in range(0,n)} | |
def _function(x): | |
return f[x] | |
return _function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment