Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>>
- >>> hand = '123'
- >>> for r in xrange(2, len(hand) + 1):
- for subset in it.permutations(hand, r):
- print subset
- ('1', '2')
- ('1', '3')
- ('2', '1')
- ('2', '3')
- ('3', '1')
- ('3', '2')
- ('1', '2', '3')
- ('1', '3', '2')
- ('2', '1', '3')
- ('2', '3', '1')
- ('3', '1', '2')
- ('3', '2', '1')
- >>> for r in xrange(2, len(hand) + 1):
- for subset in it.combinations(hand, r):
- print subset
- ('1', '2')
- ('1', '3')
- ('2', '3')
- ('1', '2', '3')
- >>>
Add Comment
Please, Sign In to add comment