1. Learn
  2. /
  3. Courses
  4. /
  5. Bayesian Data Analysis in Python

Connected

Exercise

Let's play cards

You have a regular deck of 52 well-shuffled playing cards. The deck consists of 4 suits, and there are 13 cards in each suite: ranks 2 through 10, a jack, a queen, a king, and an ace. This means that in the whole deck of 52, there are four of each distinct rank: four aces, four kings, four tens, four fives, etc.

Since there are 52 distinct cards, the probability of drawing any one particular card is 1/52. Using the two rules of probability you've learned about in the last video, calculate the probabilities of drawing some specific combinations of cards, as described in the instructions.

Instructions 1/3

undefined XP
  • 1
    • Calculate the probability of drawing a king or a queen, assign it to the variable p_king_or_queen and print it.
  • 2
    • Calculate the probability of drawing a numbered rank lesser than or equal to 5, assign it to the variable p_five_or_less and print it.
  • 3
    • Calculate the probability of drawing all four aces in a row, assign it to the variable p_four_acesand print it.