In episode 177, “Wheel of Mythfortune” of the Mythbusters show, Jamie and Adam explore the Monty Hall paradox. I wrote a small python script to simulate the problem past the break.

""" Simple simulator for the Mythbusters Pick-A-Door. ------------------------------------------------- This simulates the results of the Monty Hall paradox. It turns out that it is always advantagous to switch. Here is why: Picking a door means 1/3 chance of wining and a 2/3 chance that one of the one of the other doors is the winner. The show host opens one of the other two doors that is empty. The probability that the non-picked doors wins is still in effect. That means that the existing non-picked closed door has a 2/3 chance of being a winner. Just run and look at the numbers... - Leo Tindle This script is released in to the public domain. Do as you wish with it. """ import random stick_score = 0 switch_score = 0 for x in xrange(1000): # Pick the door that really has the prize actual = random.randint(1,3) # Take the first guess (player) pick = random.randint(1,3) # Find empty doors that we can open show_doors_avail = set((1,2,3)) # Rule out the actual winning door show_doors_avail.discard(actual) # Rule out the door the player picked show_doors_avail.discard(pick) # Randomly choose a door from available options # This will be either one (if the first guess was wrong) # or two (if the first guess was right) show = list(show_doors_avail)[ random.randint(0, len(show_doors_avail)-1)] # Randomly choose whether we stick stick = random.randint(0,1) and True or False if stick: # If we do stick, our new pick is the same as the original new_pick = pick else: # If we don't stick, find the other door we can open new_pick_avail = set((1,2,3)) new_pick_avail.discard(pick) new_pick_avail.discard(show) new_pick = list(new_pick_avail)[0] # We win if our new pick matches the actual prize door win = actual == new_pick if win: if stick: stick_score += 1 else: switch_score += 1 print("{!r}: Actual: {!r}, Pick: {!r}, Shown: {!r}, Stick: {!r}, " "New Pick: {!r}, Win: {!r}" .format(x, actual, pick, show, stick, new_pick, win)) print("---") print("Switch Score: {!r}, Stick Score: {!r}".format(switch_score, stick_score))