Permutations Code In Python