from itertools import permutations
before = [3,1,2]
after = permutations(before,2)
print(list(after))
# [(3, 1), (3, 2), (1, 3), (1, 2), (2, 3), (2, 1)]
# 경우의 수 = P(3,2)
from itertools import combinations
before = [3,1,2]
after = combinations(before,2)
print(list(after))
#[(3, 1), (3, 2), (1, 2)]