You will check the addition rule on a made-up survey of names, then write the rule itself and the complement rule as functions.
The idea. A list of names can stand for a group. A name in both lists is in the overlap. The addition rule is , and the complement rule is .
Your tasks.
in_both(group_a, group_b). Return a list of the names that are in both lists.p_union(pa, pb, pab). Return from the three probabilities.p_neither(pa, pb, pab). Return the probability that neither event happens.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…