Skip to content

Instantly share code, notes, and snippets.

@mdamien
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdamien/11064828 to your computer and use it in GitHub Desktop.
Save mdamien/11064828 to your computer and use it in GitHub Desktop.
the limit
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