You are a contestant on a game show and have won a shot at the grand prize. Befo
ID: 3538925 • Letter: Y
Question
You are a contestant on a game show and have won a shot at the grand prize. Before
you are three doors. $1,000,000 in cash has randomly been placed behind one door.
Behind the other two doors are the consolation prizes of dishwasher detergent. The
game show host asks you to select a door, and you randomly pick one. However,
before revealing the prize behind your door, the game show host reveals one of the
other doors that contains a consolation prize. At this point, the game show host asks
if you would like to stick with your original choice or to switch to the remaining
door.
Write a function to simulate the game show problem. Your function should
randomly selectlocations for the prizes, select a door at random chosen by the
contestant, and then determine whether the contestant would win or lose by
sticking with the original choice or switching to the remaining door. You may wish
to create additional functions invoked by this function.
Next, modify your program so that it simulates playing 10,000 games. Count the
number of times the contestant wins when switching versus staying. If you are the
contestant, what choice should you make to optimize your chances ofwinning the
cash, or does it not matter?
Your program should outputthe percentage of wins that would happen if you
switched and if you stayed. While the exact number may be different due to the
randomness, the law of averages will make them very close to a correct solution
(this is a well-known problem, so you should be able to find these percentages
based on the probability theory behind it).
Explanation / Answer
For 60 sec we can expect 60/50 s to process 1 request
=>for 40 s we have 60/50 * 40 s busy time
=> 60 - 60*40/50 idle time
=>60-48 = 12s
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.