Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # index_permu.py
- def index_permu(alist, index):
- alist = alist[:]
- for i in range(len(alist)-1):
- index, j = divmod(index, len(alist)-i)
- alist[i], alist[i+j] = alist[i+j], alist[i]
- return alist
- i = 0
- ttt = []
- while 1:
- t = index_permu([9,8,7,2,3,1], i)
- if t not in ttt:
- ttt += [t]
- print (t)
- i += 1
- else:
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement