Say I have this list : [1,1,2,2] I want to run through all the permutations of this. If I print the same permutation will be printed 4 times. For [1,1,1,3] the same one will be printed 6 times, For [1,1,1,3,3] 12.
In General : (a1)!(a2)!...(an)! Is there any function that does that in Python? If no, can you give me an algorithm that does in Python?