05 Factorial and counting seat arrangements
05 Factorial and counting seat arrangements#
%%html
<iframe width="700" height="400" src="https://www.youtube.com/embed/eoxbgUIYhHo/" frameborder="0" allowfullscreen></iframe>
import itertools
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats, special
persons = ['A', 'B', 'C']
seats = [1, 2, 3]
res = list(itertools.permutations(persons, len(seats)))
res
[('A', 'B', 'C'),
('A', 'C', 'B'),
('B', 'A', 'C'),
('B', 'C', 'A'),
('C', 'A', 'B'),
('C', 'B', 'A')]
len(res)
6
special.perm(len(persons), len(seats))
6.0