02 Counting outcomes flower pots#

%%html
<iframe width="700" height="400" src="https://www.youtube.com/embed/B_vAlneziHo/" 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

khanacademy

Counting outcomes flower pots fig 1

flower_types = ['Rose', 'Tulip', 'Sunflower', 'Lily']
pot_colors = ['Brown', 'Yellow', 'Green']
tree = [i for i in itertools.product(pot_colors, flower_types)]
tree
[('Brown', 'Rose'),
 ('Brown', 'Tulip'),
 ('Brown', 'Sunflower'),
 ('Brown', 'Lily'),
 ('Yellow', 'Rose'),
 ('Yellow', 'Tulip'),
 ('Yellow', 'Sunflower'),
 ('Yellow', 'Lily'),
 ('Green', 'Rose'),
 ('Green', 'Tulip'),
 ('Green', 'Sunflower'),
 ('Green', 'Lily')]
len(flower_types) * len(pot_colors)
12
len(tree)
12