# When Everyone Corrected the World’s Smartest Woman

## Using Python to prove a controversial brainteaser

--

I find the Monty Hall Problem one of the most fascinating brain teasers, because it seems deceivingly simple. When Marilyn Von Savant, the woman with the highest IQ, answered this brainteaser correctly in 1991, she was inundated with over 10,000 letters from academics and Ph.Ds criticizing her “error”, only to be proven later that she was correct.

The problem goes like this:

# The Monty Hall Problem

• You’re on a game show.
• There are three doors.
• Behind one of them is a car.
• Behind the other two are goats.
• You get to open one door, in hopes of getting the car!

But then, this happens:

Take a pause and think of what you would do and why before going on to the next line.

.

.

.

At this point, most people see it as a 50 / 50 decision. The answer, however, is that you will win 2/3 of the time by switching.

# The Intuitive Solution

The easiest way to understand this is to imagine that there is a car behind door 1, and goats behind door 2 and 3. When you pick door 1 initially, you will lose by switching. In the same scenario, had you picked door 2, the host would have shown door 3 with the goat, you would win by switching to door 1. Same if you had picked door 3. So 2/3 times, you win by switching.

# Code

I wanted to try writing the Monty Hall game in Python and have it run 10,000 times to see if I really win 2/3, or around 6,667 times out of 10,000 plays, by switching.

You can see the code and play the game here.

Here are the results:

After running it four times, the results were 6547, 6603, 6714, and 6738. All within 1% from the expected 6,667 wins (2/3 * 10,000 tries).

## Before You Go —

Did you know that you can give up to 50 👏’s by pressing down on the 👏 button? Give it a try if you really liked this article. It lets me know that I should write more!