News for hackers. Stuff that matters.
Re:The Tuesday Birthday Problem by rhettinger on Wednesday April 07, 2010 @03:53AM (#1246731)
Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)

  >>> from itertools import product
  >>> twokids = product('B G'.split(), 'M Tu W Th Fr St Sn'.split(), repeat=2)
  >>> boytues = [t for t in twokids if t[:2]==('B', 'Tu') or t[2:]==('B', 'Tu')]
  >>> twoboys = [t for t in boytues if t[0] == t[2] == 'B']
  >>> len(twoboys)
  13
  >>> len(boytues)
  27

There are no comments on this comment yet.