I need some Python code to choose x numbers from a set of y numbers and then give me all possible choices and permutations of that set. Help appreciated. The work itself is something else, this is just a tool so please spare me incentives to fully understand and program the code myself. I need the permutations for a mathematical problem which I want to solve and I don't want to do it by hand with paper and pen.
Please RT.
@freemo
@LaFemmeQuiSourit Sorry but I am yet to learn Python.😔
@LaFemmeQuiSourit @freemo I think itertools.permuations will do what you need: https://docs.python.org/3.7/library/itertools.html#itertools.permutations
@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.
@LaFemmeQuiSourit @freemo
If I understand correctly, you just need the std lib
import itertools as it
y = [1,2,3,4,5,6]
x = 3
list(it.combinations(y, x))
cc @themystery