how to find permutation of numbers in python

Solutions on MaxInterview for how to find permutation of numbers in python by the best coders in the world

showing results for - "how to find permutation of numbers in python"
Josué
21 Oct 2017
1def permute(LIST):
2    length=len(LIST)
3    if length <= 1:
4        yield LIST
5    else:
6        for n in range(0,length):
7             for end in permute( LIST[:n] + LIST[n+1:] ):
8                 yield [ LIST[n] ] + end
9
10for x in permute(["3","3","4"]):
11    print x
12