Generalized probability environment to simulate deck draws


Given a standard deck of cards, write code to calculate the probability of being dealt the following in a single hand of 5 cards:

  • A flush (all 5 cards of the same suit)
  • 3 of a kind (3 cards of the same rank -- e.g. 3 Aces, 3 Twos, 3 Threes, etc.)

Hint: Recommend first building your standard card deck, and then setting up a function to pull a random draw of cards.


Access restricted

Subscribe to premium account to see the solution.

Get premium now