Last active
August 29, 2015 14:13
-
-
Save mjhb/a8e9dc6bf30c573c7060 to your computer and use it in GitHub Desktop.
All consecutive non-overlapping tuples within a range
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
from itertools import combinations | |
[p for p in combinations([(i, i+1) for i in range(1,5)],2) if p[0][0] not in p[1] and p[0][1] not in p[1]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment