Skip to content

Instantly share code, notes, and snippets.

@eyaltrabelsi
Last active June 21, 2019 20:33
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 eyaltrabelsi/fcb578022d750ab53b9ac655df299717 to your computer and use it in GitHub Desktop.
Save eyaltrabelsi/fcb578022d750ab53b9ac655df299717 to your computer and use it in GitHub Desktop.
Python-tricks generate cartesian products
>>> 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