Skip to content

Instantly share code, notes, and snippets.

@buhii
Created March 10, 2014 19:28
Show Gist options
  • Save buhii/9472466 to your computer and use it in GitHub Desktop.
Save buhii/9472466 to your computer and use it in GitHub Desktop.
from collections import Counter
from random import sample
def try_boy():
result = []
child = sample(("Boy", "Girl"), 1)[0]
result.append(child)
if child == 'Girl':
result.extend(try_boy())
return result
if __name__ == "__main__":
result = Counter()
for i in range(10000):
children = try_boy()
result.update(children)
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment