09.14.06

Monty hall

Posted in Development, Python, maths at 10:34 pm by Twm

With my broken leg elivated I was watching “Deal or no Deal” on daytime TV and got wrapped up in probabilty problems related to game shows on the web. In the process I stumbled on the monty hall problem and remember being intrigued by this little counter-intuitive gem when I first discovered it.

I can’t explain it better than this excellent video:

So since I’m learning Python. I wrote a little script do play the game a few thousand times and report the actual outcomes to see if they really do match up with the theory.

Monte hall simulator
======================
When Playing a game of 10000 tries.
The probability of winning when switching is: 0.6667 (theoretical 2/3 = 0.66666…)
The probability of winning while sticking is: 0.3333 (theoretical 1/3 = 0.3333…)

Link: The code

Leave a Comment

You must be logged in to post a comment.