Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I was lazy so I just did:

import itertools as itools

xs = [f'{i}-{j}' for i in range(30) for j in range(12)]

ys = ['b', 'g']

zs = list(itools.product(xs, ys))

boys = [z for z in zs if z[1] == 'b']

len(boys)/len(zs)

----

gives me 0.5, or 1/2.

The moral of the article is to set up your universal set correctly and do not throw out any information, now matter how irrelevant.



Now I tell you I have two children, and (at least) one of them is a boy born on April 1st, has medium-length black hair, is 4'2", interested in 5 out of 12000 available rpg games, has 8 close friends and sword-shaped fingernails.

I believe your script may require a datacenter and a scalable architecture now.


And what do you do with non-discrete attributes?


But that's exactly what you did! You just counted which fraction of all kids is boys. You threw away that this is about pairs of kids, about april 1 on which one of them has their birthday and is a boy, and we want to know the sex of the other one. You already simplified by applying symmetry reductions. You could have just done print(1/2) and proclaimed that the output was 0.5 which therefore must be the solution.


But in this case the moral of the article is exactly the opposite - if you throw out the irrelevant information the answer becomes trivial (no need for your calculations).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: