Skip to content

chrissprague/MontyHall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MontyHall

A concise python script to help in understanding the Monty Hall problem.

Suppose you're on a game show, and you're given the choice of three doors. Behind one door is a car, behind the others, goats. You pick a door, say #1, and the host, who knows what's behind the doors, opens another door, say #3, which has a goat. He says to you, "Do you want to pick door #2?" Is it to your advantage to switch your choice of doors? Yes; you should switch. The first door has a 1/3 chance of winning, but the second door has a 2/3 chance. Here's a good way to visualize what happened. Suppose there are a million doors, and you pick door #1. Then the host, who knows what's behind the doors and will always avoid the one with the prize, opens them all except door #777,777. You'd switch to that door pretty fast, wouldn't you?

Usage:

./monty

Still not convinced? Try running the simulation with more doors and see the results for yourself, e.g.:

./monty -d=100

About

Py script to understand the Monty Hall problem (get it - Monty Hall, in Python?)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages