Skip to content

Instantly share code, notes, and snippets.

Created April 6, 2014 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/10010100 to your computer and use it in GitHub Desktop.
Save anonymous/10010100 to your computer and use it in GitHub Desktop.
107436.py
from __future__ import division
import random
def result():
a = [random.random()>0.5, random.random()>0.5, random.random()>0.5, random.random()>0.5, random.random()>0.5, random.random()>0.5, random.random()>0.5, random.random()>0.5, random.random()>0.5, random.random()>0.5]
r = [True, True, True, True, True]
if a[0:5] == r or a[1:6] == r or a[2:7] == r or a[3:8] == r or a[4:9] == r or a[5:10] == r:
return True
else:
return False
if __name__ == '__main__':
count = 0
for i in range(1,10000000):
r = result()
if r:
count = count + 1
print(count / i - 7/64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment