The Monty Hall problem is a probability puzzle rooted in a game show scenario. This repository provides a Python simulation to demonstrate the solution to the problem.
Imagine you're a contestant on a game show. There are three doors in front of you:
- Behind one door is a car.
- Behind the other two doors are goats.
The game goes as follows:
- You choose a door.
- The host, Monty Hall, who knows what's behind each door, opens one of the other two doors to reveal a goat.
- You then have a choice to stick with your original door or switch to the other unopened door.
The question is: Is it in your best interest to stick with your original choice, switch, or does it not matter?
Statistically speaking, you have a better chance of winning the car if you always choose to switch. Your probability of winning if you stick with your original choice is 1/3, but if you switch, it becomes 2/3.
For an in-depth explanation, refer to the Monty Hall problem on Wikipedia.
The provided Python script simulates the Monty Hall problem multiple times to empirically demonstrate the above probabilities.
Ensure you have Python installed and then run the script:
python monty_hall_simulation.py
The script will simulate the game 1,000 times and provide statistics on the number of wins when sticking vs. switching.