An automated simulation of the Monty Hall problem
The premise of the Monty Hall problem is a game imperfect, changing information. The basic rules are three or more doors, in this case three, where only one door is the winning door. Initially, the player, in this case the computer, has a 1/3 chance of winning. The trick is after the player choses the door, n-2 doors are revealed and let each door revealed be a losing door. The player then has the option to switch their choice. In this script both options are simulated per game with statistics at the end showing the switch option winning ~2/3 of the time. This shows how the probability of the winning changes when the switch option is used. Due to the new information, switching will win (n-1)/n times as opposed to staying which wins 1/n times. So switching winning ~2/3 of the time was expected and also what is shown in the original problem. It should be noted that since both options are simulated per game, it is impossible for both options being the winning strategy.
For more information on this problem: https://en.wikipedia.org/wiki/Monty_Hall_problem