A script to implement the monty hall problem
A game show contestant has to choose one of three doors. Behind one is the major prize - a car - and behind the other two are goats. The probabilities of the car being behind any given door are equal - one in three.
But after the contestant has chosen a door, the host (who knows where the car is) points to another door, different from the one chosen by the contestant, and opens it to show that there is a goat behind it.
He can always do this, you understand: since there is only one car, at least one of the two unchosen doors conceals a goat. Sometimes they both do (when the contestant has chosen the car).
Now comes the big question. Does the contestant's chance of winning the car improve if they now change their mind and switch to the 'third' door - the one they didn't choose to begin with, and which the host has not opened?