@LaFemmeQuiSourit @freemo If you will search how to code "factorial" (https://www.google.com/search?hl=en&as_q=factorial+python) then you are done (https://en.wikipedia.org/wiki/Permutation#k-permutations_of_n).
You just need to know whether you want permutations wit repetition or not.