Skip to content

Instantly share code, notes, and snippets.

@pauloromeira
Last active January 1, 2018 04:31
Show Gist options
  • Save pauloromeira/88b9acd0cfe0c9d34665782641da6ccf to your computer and use it in GitHub Desktop.
Save pauloromeira/88b9acd0cfe0c9d34665782641da6ccf to your computer and use it in GitHub Desktop.
Monty Hall Proof
#!/usr/bin/env python
from random import shuffle
options = [1, 0, 0]
iterations = 1000000
stick = 0
change = 0
for _ in range(iterations):
shuffle(options)
stick += options[0]
change += options[1] + options[2]
print('stick: {:.2%}'.format(stick/iterations))
print('change: {:.2%}'.format(change/iterations))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment