Function combn(x,m)
in R generates all combination of the elements x taken m at a time. For instance,
t(combn(5,2))
[,1] [,2]
[1,] 1 2
[2,] 1 3
[3,] 1 4
[4,] 1 5
[5,] 2 3
[6,] 2 4
[7,] 2 5
[8,] 3 4
[9,] 3 5
[10,] 4 5
How can I have the same result in python? I know scipy.misc.comb
gives just the result not the list and I also read this article which seems different and needs a given list at first not just simply two integer numbers.