17. Drawing a Hand From One Group

Medium

From a deck of deck_size cards containing a special group of group_size cards, you draw draw cards at once. Since order does not matter:

P=(groupdraw)(deckdraw)P = \frac{\binom{\text{group}}{\text{draw}}}{\binom{\text{deck}}{\text{draw}}}

Return the probability that every drawn card comes from the group.

solve(52, 4, 2)  ->  0.004524886877828055     # both cards are aces, = 1/221

Sign in to write and run your own code.

Implement solve(...)