# 1. Print all combinations
from itertools import combinations
comb = combinations([1, 1, 3], 2)
print(list(combinations([1, 2, 3], 2)))
# Output: [(1, 2), (1, 3), (2, 3)]
# 2. Counting combinations
from math import comb
print(comb(10,3))
#Output: 120
from itertools import permutations
from itertools import combinations
p = permutations([1,2,4]) # or permutations([1, 2, 3], 2)
for i in p:
print(i)
c = combinations([1,2,3],2)
for j in c:
print(j)
>>> from math import comb
>>> comb(10,3)
120