Audience: Beginning programming students
The Monty Hall problem is based on the old TV game show Let’s Make a Deal. In that show, the moderator, Monty Hall, would select a member of the audience, and offer them a valuable prize. The prize was behind one of three doors. Behind the other two were joke prizes, like a goat and a can of paint. The member of the audience would select one of the doors (say, door number 2). Monty would then say, “Before I show you what’s behind door number 2, let me show you what’s behind door number 1.” Door number 1 would open, to show the can of paint. Then Monty would ask if the player wanted to change to a different door. The question is, should the player do so?
Write a program to simulate 100,000 iterations of the Monty Hall problem. Use the simulation to demonstrate whether it is to the player’s advantage to change doors.