Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def arrangement(tableau, n):
- i = 0
- if (n == 0):
- print(tableau)
- else :
- for i in range(n+1):
- arrangement(tableau, n-1)
- if (n%2 == 0):
- x = tableau[i]
- tableau[i] = tableau[n]
- tableau[n] = x
- if (n%2 == 1):
- x = tableau[0]
- tableau[0] = tableau[n]
- tableau[n] = x
- return(tableau)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement