Last active
August 29, 2015 14:00
-
-
Save mdamien/11064828 to your computer and use it in GitHub Desktop.
the limit
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
def cross(X,Y): | |
if len(X) == 0: | |
for y in Y: | |
yield y | |
for x in X: | |
for y in Y: | |
yield (x,y) | |
def combination(n): | |
els = () | |
for i in range(n): | |
print(i,els) | |
els = list(cross(els,range(n))) | |
return els | |
for x in combination(3): | |
print(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment