Comment

Comment by x0054

My python is really rusty, but if you convert this sudocode to python, you will see that the answer is 50/50. I'll write this up in Javascript when I have time. If you do this in Python, please post.

   girl = 0
   boy  = 0

   do 10000 times {
      child1Sex = randomSex;
      child1Day = randomDay;
      child2Sex = randomSex;
      child2Day = randomDay;
      if ( (child1Sex == "B" AND child1Day == "Tu") OR (child2Sex == "B" AND child2Day == "Tu") ) {
         if (child1Sex == child2Sex){
            boy++
         } else {
            girl++
         }
      }
   }

   print "Ratio of boys and girls is " + boy " : " + girl;
parent x0054 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton