Guest User

Untitled

a guest
Feb 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. >>>
  2. >>> hand = '123'
  3. >>> for r in xrange(2, len(hand) + 1):
  4.     for subset in it.permutations(hand, r):
  5.         print subset
  6.  
  7.        
  8. ('1', '2')
  9. ('1', '3')
  10. ('2', '1')
  11. ('2', '3')
  12. ('3', '1')
  13. ('3', '2')
  14. ('1', '2', '3')
  15. ('1', '3', '2')
  16. ('2', '1', '3')
  17. ('2', '3', '1')
  18. ('3', '1', '2')
  19. ('3', '2', '1')
  20. >>> for r in xrange(2, len(hand) + 1):
  21.     for subset in it.combinations(hand, r):
  22.         print subset
  23.  
  24.        
  25. ('1', '2')
  26. ('1', '3')
  27. ('2', '3')
  28. ('1', '2', '3')
  29. >>>
Add Comment
Please, Sign In to add comment