Project 19: Tree Prob B

Suppose a hat has 4 red marbles and 6 blue marbles.  If we were to pick two marbles from the hat, the tree diagram below shows the probability of each possible event (the universe).

The probability of red then red is 2/15

The probability of red then blue is 4/15

The probability of blue then red is 12/45 = 4/15

The probability of blue then blue is 15/45 = 5/15  (or 1/3)

The sum of these four probabilities is 15/15 = 1

Project 19: Variables 'pA', 'pBGivenA', and 'pNBGivenNA' have been initialized.  

the probability of A (2/5 in the first example)

 the probability of B given A (1/3 in the first example)

the probability of not B given not A (5/9 in the first example)

Task: Appropriately initialize the value of 'pB' that represents the probability of B.  The value of p(B) is 9/15 (4/15 + 5/15) for the first example which would represent the probability that the second marble was blue.

**If your code works for 5 test cases, you can enter your e-mail address

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0