Skip to content

Instantly share code, notes, and snippets.

@ExplodingCabbage
ExplodingCabbage / simulation.py
Last active January 5, 2020 19:37
Monty Hall Problem Monte Carlo simulation
# A simulation to settle a Twitter argument:
# https://twitter.com/brenorb/status/1213898659752038400
import random
random.seed(42) # For reproducible results
# We have four possible scenarios we can simulate, based on these two bools.
# The first determines whether it's permissible for the host to reveal the car
# on the first door-opening. The second determines whether the contestant is
# using an "always swap" strategy or an "always stick" strategy.