Skip to content

Instantly share code, notes, and snippets.

@showyou
Created February 23, 2010 14:19
Show Gist options
  • Select an option

  • Save showyou/312194 to your computer and use it in GitHub Desktop.

Select an option

Save showyou/312194 to your computer and use it in GitHub Desktop.
E = 0
up = 1
max = 8
for i in range(1,max+1):
print "i %d" % i,
print "up %f" % up,
p = 1.0/float(max+1-i)
print "p %f" % p,
print "p*up %f" % (p*up),
E += p * up * i
print "E %f" % E
up *= 1.0-p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment