Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2013 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4495738 to your computer and use it in GitHub Desktop.
Save anonymous/4495738 to your computer and use it in GitHub Desktop.
import random
ages = []
for _ in xrange(1000000):
age = 0
while random.random() > 0.01:
age += 1
ages.append(age)
print float(sum(ages)) / len(ages)
print 'median: %d' % sorted(ages)[len(ages)/2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment