Estimate P(A∣B) from paired binary observations: among the cases where B happened, the fraction where A also happened.
Implement solve(A, B).
Returns. Return a float. Any non-zero entry counts as true. If B never occurs the conditional probability is undefined and the function returns 0.0.
Example 1
Input:
solve([1, 0, 1, 1], [1, 1, 1, 0])
Output:
0.666667
Example 2
Input:
solve([1, 1], [0, 0])
Output:
0.0
No results yet
Run your code to check it against the examples, or submit to run every test.