12 Combination example 9 card hands#

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

khanacademy

Combination example 9 card hands fig 1Combination example 9 card hands fig 2

suits = ['Diamonds', 'Hearts', 'Clubs', 'Spades']
hands = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
deck = ["-".join(i) for i in itertools.product(hands, suits)]
deck
['1-Diamonds',
 '1-Hearts',
 '1-Clubs',
 '1-Spades',
 '2-Diamonds',
 '2-Hearts',
 '2-Clubs',
 '2-Spades',
 '3-Diamonds',
 '3-Hearts',
 '3-Clubs',
 '3-Spades',
 '4-Diamonds',
 '4-Hearts',
 '4-Clubs',
 '4-Spades',
 '5-Diamonds',
 '5-Hearts',
 '5-Clubs',
 '5-Spades',
 '6-Diamonds',
 '6-Hearts',
 '6-Clubs',
 '6-Spades',
 '7-Diamonds',
 '7-Hearts',
 '7-Clubs',
 '7-Spades',
 '8-Diamonds',
 '8-Hearts',
 '8-Clubs',
 '8-Spades',
 '9-Diamonds',
 '9-Hearts',
 '9-Clubs',
 '9-Spades']
# don't will fuck your memory
# list(itertools.combinations(deck, 9))
special.comb(36, 9)
94143280.0