I am looking for a way to generate all combinations of items in a given list with an output of a given count. The inputs will be the list and the number of items in each returned combination. For example:
list = [a, b, c, d]
number of items in output: 2
returns:
[(a, b), (a, c), (a, d), (b, c), (b, d), (c, d)]
The same list with number of items in output: 3
returns:
[(a, b, c), (a, b, d), (a, c, d), (b, c, d)]
note that (a, b) == (b, a) etc.
Thanks!