itertools.combinations(iterable, r)
all_combinations = [list(zip(each_permutation, list2)) for each_permutation in itertools.permutations(list1, len(list2))]
import math
n=7
k=5
print(math.comb(n, k))
import itertools
list1 = list(range(5, 10))
list2 = [1, 2, 3]
list = [list1, list2]
combination = [p for p in itertools.product(*list)]
print(combination)
PythonCopy
import itertools
stuff = [1, 2, 3]
for L in range(len(stuff) + 1):
for subset in itertools.combinations(stuff, L):
print(subset)