combinations - Python get all permutations of numbers -
i'm trying display possible permutations of list of numbers, example if have 334 want get:
3 3 4 3 4 3 4 3 3
i need able set of digits 12 digits long.
i'm sure simple using itertools.combinations can't quite syntax right.
tia sam
>>> lst = [3, 3, 4] >>> import itertools >>> set(itertools.permutations(lst)) {(3, 4, 3), (3, 3, 4), (4, 3, 3)}
Comments
Post a Comment