Question: *simulate a monty hall problem in python. Recall the Monty Hall problem. The game show host Monty Hall shows you 3 doors: 2 doors contain

*simulate a monty hall problem in python.

Recall the Monty Hall problem. The game show host Monty Hall shows you 3 doors: 2 doors contain nothing

and 1 door contains a prize. Monty asks you to choose a door. You choose a door. Monty then opens one

of the doors you didnt open, which you see does not contain the prize. (Monty always opens a non-prize

door.) He now asks you whether youd like to switch your door. Should you switch?

In a Monte Carlo simulation, you perform a trial of several experiments, analyze the quality of the trial, and

repeat the batch of trials with a larger sample size if the quality is lower than you want.

-create three functions:

-one function that finds the door monty will open

-another function that finds the door the contestant could switch to

-one last function that is the monty hall experiment:

experiment steps:

Choose the prize door randomly and uniformly over [1,2,3].

Choose your door randomly and uniformly over [1,2,3].

Monty Hall chooses the door that is not the prize door and not your door.

You may or may not switch to the remaining door.

With the never-switch policy, you never switch.

With the always-switch policy, you always switch.

With the random-switch policy, you flip a fair coin to decide if you switch.

The experiment yields an answer: did you win the prize?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!