# p and c in python

# permutation and combinataion in python # let a list of dice having numbers 1 to 6 import itertools lst = [1, 2, 3, 4, 5, 6] # PERMUTATIONS of two numbers. print(list(itertools.permutations(lst, 2))) # COMBINATION of two numbers print(list(itertools.combination(lst,2)))

**Here is what the above code is Doing:**

1. itertools.permutations(lst, 2)

– This returns a list of tuples. Each tuple contains 2 elements.

– The first element is the first element of the list.

– The second element is the second element of the list.

– The third element is the third element of the list.

– And so on.

2. list(itertools.permutations(lst, 2))

– This converts the list of tuples into a list.