Guest User

Untitled

a guest
Oct 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. def permu(n):
  2. if n==1:
  3. return [[1]]
  4. else:
  5. L=permu(n-1)
  6. Ln=[]
  7. for p in L:
  8. for i in range(n):
  9. q=[]
  10. q=p[:]
  11. q.insert(i,n)
  12. Ln.append(q)
  13. return Ln
  14. print permu(5)
Add Comment
Please, Sign In to add comment