Last active
January 1, 2018 04:31
-
-
Save pauloromeira/88b9acd0cfe0c9d34665782641da6ccf to your computer and use it in GitHub Desktop.
Monty Hall Proof
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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