[1]:
%run ../initscript.py
HTML("""
<div id="popup" style="padding-bottom:5px; display:none;">
    <div>Enter Password:</div>
    <input id="password" type="password"/>
    <button onclick="done()" style="border-radius: 12px;">Submit</button>
</div>
<button onclick="unlock()" style="border-radius: 12px;">Unclock</button>
<a href="#" onclick="code_toggle(this); return false;">show code</a>
""")
[1]:
show code
[2]:
%run loadoptfuncs.py
toggle()
[2]:

Monty Hall Problem

The problem is well described by this movie (“21”) clip. The simulation game can be played in this link.

[3]:
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/cXqDIFUB7YU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>')

Without loss of generality, we assume that the player always selects door 1 at the beginning of the game. The simulation shows that the “switch” strategy achieves a higher probability for winning the car.

[4]:
widgets.interact_manual.opts['manual_name'] = 'Run Simulation'
interact_manual(montyhall,
                sample_size=widgets.BoundedIntText(value=100, min=100, max=10000,
                                                   description='Sample Size:', disabled=False));