Hello, thanks for checking out the Python portion of my blog!
Click here to link back to the main page.
Probability Puzzles
If you know of any fun probability puzzles, please feel free to contact me! I am constantly adding new puzzles and I would love to include them here. There are quite a few puzzles at the end of this page that I have yet to provide a solution.
Birthday Paradox
If you are unfamiliar with the birthday paradox, see the Wikipedia article here.
Here I have broken the puzzle into two different parts.
Part I
Create a simulation to prove that a 50% probability of two people having the same birthday is reached with only 23 people.
Part II
A professor lines her students up in a single-file row and tells them that the first person to have a matching birthday of someone in front of them receives a passing grade. Which individual has the best chance of winning?
Click here to view my solution.
Simulating A Multiple-Choice Exam
Everyone can relate to taking an exam and finding yourself guessing at the answers more then what you would like.
Here we simulate a multiple-choice exam where you divide the questions into three probabilities of attaining a correct answer and determine a probability of achieving a desired score.
Click here to view my solution.
Weather in Probability Land
In Probability Land, on a sunny day there is an equal probability of the next day being sunny or rainy. On a rainy day, there is a 70% chance it will rain the next day, and a 30% chance it will be sunny the next day.
On average, how many rainy days are there in Probability Land?
Click here to view my solution.
How Many People Are Visible?
There are 5 people each with a different height. They all stand in a straight line, and you stand directly in front looking at them.
How many different arrangements of those 5 people are possible that would have exactly 3 people visible to you?
Click here to view my solution.
Find Your Seat: Airplane Probability Problem
You are running late in an airport and are in the very back of the line to board your plane. The plane seats fifty people. The first person in line forgot his seat number and chooses a seat at random when he enters the plane. Each subsequent person will sit in their assigned seat unless it is taken by someone else. If they find their seat already occupied, they will choose another seat at random.
If you are the last person to board the plane, what is the probability that you will get your assigned seat?
Click here to view my solution.
Coin Flipping Game
Your friend has a coin and asks you if you want to play a game:
“I will flip this coin until the number of heads flipped is equal to the number of tails flipped. Then I will give you a dollar for each time I flipped the coin.”
What are the chances that you play this game with your friend once and he pays you exactly eight dollars?
Click here to view my solution.
Loaded Coin Riddle
You need to settle a dispute by means of a coin flip.
The only coin available to you is an old wooden nickel and you are certain that it comes up heads more than 50% of the time. How can you be sure to have a fair contest that is based purely on chance by only flipping this coin?
Determine a solution to the riddle and demonstrate its accuracy via a simulation. Note, there may be more than one possible solution to this riddle.
Click here to view my solution.
How Many Visitors?
If my super fancy puzzle website averages 12 visitors a day, what are the chances of…..
Getting exactly 10 visitors a day?
Getting 10 or more visitors a day?
You will need to use a Poisson distribution to solve this problem.
Click here to view my solution.
Unknown Deck of Cards
You possess a deck with 50 cards that has an unknown and random number of red and black cards. What is the probability of drawing a red card from the deck?
Click here to view my solution.
Unfair Dice
You have 2 dice; 1 is fair and the other unfair. The unfair dice rolls a 6 50% of the time.
What is the probability of choosing the unfair dice if you randomly choose a dice and roll a 6?
Click here to view my solution.
Dealing An Ace
In poker, the first person to be dealt an Ace gets the role of dealer. Is the probability of being dealt the first Ace equal for all players?
Create a simulation to find out.
Click here to view my solution.
Get Out Of Jail
You are locked in a jail cell and demand to be released because you are innocent. The warden tells you he will release you if you can win 2 straight games of checkers. But you must play at least 1 game against the warden and 1 game against the sheriff. You know the sheriff plays a better game of checkers then the warden.
Do you have a better probability of winning if you play [Warden -> Sheriff -> Warden] or [Sheriff -> Warden -> Sheriff]?
Remember, the sheriff is a better checkers player then the warden, and you must win 2 straight games.
Click here to view my solution.
Pearly Gates
You die and arrive at the pearly gates of heaven. Unfortunately, the pearly gates are a set of three random doors. One door leads directly to heaven, one door leads to a 2 day stay in purgatory, and one door leads to a 3 day stay in purgatory. Once you are done with your stay in purgatory, you are back again to the pearly gates where the doors are again randomized.
What is your average stay in purgatory?
Click here to view my solution.
Favorite Child
You live in a society where female children are preferred over male children. By law, couples have to conceive children until they produce a female offspring. If their first child is male, they are allowed to have additional children until a female is born. Once a female is born, they are allowed no additional children.
What is the average ratio of females to males in this society?
Click here to view my solution.
Cell Reproduction
You are conducting a controlled experiment where you have a single cell. After a certain and reoccurring amount of time, the cell has a 2/5 chance of dying, 2/5 chance of being idle, and a 1/5 chance of replicating. After a replication, each cell has the same amount of probability.
Given 1 million trials, what is the maximum number of cells produced?
Click here to view my solution.
Shuffled Card Deck
Given a randomly shuffled deck of cards, where the numbered cards (1-10) are face value, the Ace is equal to 1, a Jack is equal to 11, a Queen is 12 and a King is 13.
What is the average number of cards in a shuffled deck that are in the correct numerical place?
For example, if an Ace is in the 1st, 14th, 27th, or 40th place in the deck, it would be considered in its proper numerical place.
Click here to view my solution.
Three Dice Rolls
The casino has an interesting new game.
You start with a bankroll of $100 and place a $1 bet on a number 1 through 6. You then roll three dice, and if any of the dice rolls match your original bet, you win the number of matching dice ($1, $2, or $3), plus your original $1 bet back. If you lose, your bankroll goes down $1. You must play the game 100 times, and you keep the sum of your bankroll at the end of the 100 dice rolls.
What are the odds of winning?
Click here to view my solution.
Matching Cards In Two Decks
If you shuffle two separate decks of cards, what is the probability of the same card appearing in the exact same position in the two separate decks?
Click here to view my solution.
Increasing Percentage Gamble
A casino has a new game. A gambler can bet $10 and get a 1% chance of winning $100. If the gambler loses, they can bet another $10, and their chance of winning increases from 1% to 2%. After each loss, the gambler can bet $10, and the chance of winning will increase 1%.
What is the average number of bets the gambler must place to win the $100? Is this game in favor of the gambler or the casino?
Answer to come….
Pitching a Complete Game
Your All-Star baseball pitcher has a 15% chance of pitching a complete game. After how many starts does the pitcher have a 90% chance of pitching a complete game?
Answer to come….
Star Basketball Player
A basketball team has a 1/3 chance of completing a 3 point field goal, and a 1/2 chance of completing a 2 point field goal.
Their arch rival averages 120 points per game.
If the team attempts 100 strictly 3 point shots, what is their probability of winning against their arch rival?
If the team attempts 100 strictly 2 point shots, what is the probability of winning against their arch rival?
Answer to come….
Coupon Collecting
This problem is called the coupon collector’s problem.
A cereal is running a promotion where if you collect all 10 coupons, you win a prize. A coupon is only available if you buy a box of their cereal. What is the average number of box purchases needed in order to collect all 10 coupons?
Answer to come….
Sum and Product Puzzle
This puzzle is called the Sum and Product Puzzle.
Solve the puzzle via a Python script.
X and Y are two different whole numbers greater than 1. Their sum is not greater than 100, and Y is greater than X. S and P are two mathematicians (and consequently perfect logicians); S knows the sum X + Y and P knows the product X × Y. Both S and P know all the information in this paragraph.
The following conversation occurs (both participants are telling the truth):
- S says “P does not know X and Y.”
- P says “Now I know X and Y.”
- S says “Now I also know X and Y.”
What are X and Y?
Answer to come….
Simulating the Monty Hall Problem
Run a simulation of the Monty Hall problem. But here is the catch, code the simulation so that all the variables are parameterized.
Answer to come….
Four Vehicles Puzzle
Given the following four vehicles:
- 1 seat motorcycle
- 2 seat sidecar
- 3 seat golf cart
- 4 seat car
There are 10 people total, 5 of them are children, 5 are adults. Only an adult can be a driver of a vehicle.
Create a table of all 7,200 possible permutations, assuming that seating order does not matter (it only matters what vehicle they are in).
Answer to come….
Winning Percentage
Your favorite football team has the following pre-season estimated win percentages for their 12 game schedule. What is the most likely outcome for their final win total? The win percentages are 95%, 26%, 55%, 63%, 45%, 75%, 60%, 52%, 51%, 72%, 59% and 81%.
Answer to come….
White Ball
In a bag there is ball that has an equal chance of being either black or white. If you put a white ball into the bag (so that the bag contains one white ball and one ball with unknown color), and draw a random ball from the bag, what is the probability that the ball left inside the bag is white if you draw a white ball?
Answer to come….
Keep the Prize
A host and 10 guests are seated around a circular table for a dinner party. After dinner the host reveals a box which contains a prize and offers the following game. The host will flip a fair coin, if heads the host will pass the prize to the left, if tails the host will pass the prize to the right. The host continues the coin flip , where the participant holding the box must either pass to the left or to the right. The last individual around the circular table to not hold the prize wins. What seat around the circular table has the highest chance of winning?
Answer to come….
Sicherman Dice
Sicherman dice are a pair of 6-sided dice with non-standard numbers–one with the sides 1, 2, 2, 3, 3, 4 and the other with the sides 1, 3, 4, 5, 6, 8. They are notable as the only pair of 6-sided dice that are not normal dice, bear only positive integers, and have the same probability distribution for the sum as normal dice.
Run a simulation to prove Sicherman dice have the same probability as a normal pair of dice
Happy coding!