Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # permutations.py
- import itertools
- for p in itertools.permutations([1, 2, 3, 4], 3):
- print(''.join(['abcd'[i-1] for i in p]))
- '''
- abc
- abd
- acb
- acd
- adb
- adc
- bac
- bad
- bca
- bcd
- bda
- bdc
- cab
- cad
- cba
- cbd
- cda
- cdb
- dab
- dac
- dba
- dbc
- dca
- dcb
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement