Here is the homework problem: For the “Monty Hall” problem discussed in class, modify the code montyhallproblem.py (shown below) to have Monty open a door at random (after a door is selected by the contestant). This means that in some cases Monty will open a door with the car, which means the contestant cannot win in this situation. Demonstrate (with your code) that switching your door yields a 50% chance of winning the car. You will have to edit the code in the part of the codewhere the door is opened(remember to prevent the code from opening the door that is already selected!).
Here is the code mentioned above:
NOTE: You might need to look up the Monty Hall problem before answering this.
In all honesty, I understand the way I do it better than the way my professor does it, so here's what I have:
At the moment, what I'm trying to do is figure out how to make sure that the door Monty opens ("doorC") isn't the same door that I opened ("doorA"). I can't figure out how to do this. I'm doing this on Jupyter Notebook, which uses Python 3. It's a part of the Anaconda program.
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
Hi Callie. The first I thing I noticed is that the "permutations" function you are using doesn't seem to be yielding the array you need. In your professor's code, he generates an array with elements [1, 0, 0], [0, 1, 0], and [0, 0, 1]. This represents all the different starting arrangements for the doors. However, the array which your function is producing appears to be yielding [1, 0, 0], [1, 0, 0], and [0, 1, 0], so the first 2 are the same and the last one is missing.
Perhaps this is the issue?