Created
March 28, 2019 21:13
-
-
Save laerreal/6a24eef9028921dbbbb4f483c03a4493 to your computer and use it in GitHub Desktop.
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
from random import choice | |
# https://www.youtube.com/watch?v=HzbObZRCy9U | |
cards = [(True, True), (False, False), (True, False)] | |
N = 100000 | |
matches = 0 | |
for _ in range(N): | |
c = choice(cards) | |
matches += (c[0] == c[1]) | |
print("%f" % (float(matches)/float(N))) |
Author
laerreal
commented
Mar 28, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment