Last active
June 21, 2019 20:33
-
-
Save eyaltrabelsi/fcb578022d750ab53b9ac655df299717 to your computer and use it in GitHub Desktop.
Python-tricks generate cartesian products
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
>>> for p in itertools.product([1, 2, 3], [4, 5]): | |
>>> print(''.join(str(x) for x in p)) | |
(1, 4) | |
(1, 5) | |
(2, 4) | |
(2, 5) | |
(3, 4) | |
(3, 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment