Skip to content

Instantly share code, notes, and snippets.

@brettfreer
Created June 5, 2016 10:55
Show Gist options
  • Save brettfreer/8bfd46c957c9cce684dd870573c8e179 to your computer and use it in GitHub Desktop.
Save brettfreer/8bfd46c957c9cce684dd870573c8e179 to your computer and use it in GitHub Desktop.
Return all 2 part combinations of a list
from itertools import combinations
def f(A):
for p in combinations(A, 2):
return p[0], p[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment