fork(2) download
  1. from random import randint, sample
  2.  
  3. s = []
  4. for i in xrange(100000):
  5. r = randint(1,81)
  6. a = ([True] * r) + ([False] * (81 - r))
  7. b = sample(a, 9)
  8. if b[0] and b.count(True) == 3:
  9. s.append(r)
  10.  
  11. print float(sum(s)) / len(s)
Success #stdin #stdout 0.13s 120576KB
stdin
Standard input is empty
stdout
29.0976977568