Need a unique gift idea?
A Pastebin account makes a great Christmas gift


a guest Jun 13th, 2018 49 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. def permutations(l, indexlist=[]):
  2.     if len(l) == len(indexlist):
  3.         print [l[i] for i in indexlist]
  4.     else:
  5.         for i in xrange(len(l)):
  6.             if not i in indexlist:
  7.                 indexlist.append(i)
  8.                 permutations(l, indexlist)
  9.                 del indexlist[-1]
  11. permutations([1, 2, 3, 4])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand