Skip to content

Instantly share code, notes, and snippets.

@Duta
Created February 6, 2014 15:39
Show Gist options
  • Save Duta/8846589 to your computer and use it in GitHub Desktop.
Save Duta/8846589 to your computer and use it in GitHub Desktop.
Printing all permutations of {1, 2, 3, 4} in python
# Use this version if you have Python 2.7
from itertools import permutations
for perm in permutations([1,2,3,4]):
print perm
raw_input()
# Use this version if you have Python 3.3
from itertools import permutations
for perm in permutations([1,2,3,4]):
print(perm)
input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment