Question: Question 2 Consider two boxes. Box A contains 7 blue and 5 red marbles, while box B contains 6 blue and 8 red marbles. A

Question 2
Consider two boxes. Box A contains 7 blue and 5 red marbles, while box B contains 6 blue and
8 red marbles. A box is selected at random, and 4 marbles are drawn from it at random.
Let x= number of blue balls in the sample of 4 marbles.
Part a)
Create a python function prob() with only one input variable k, and which for any
kin{0,1,2,3,4} computes the value of P(x=k). Do NOT round the output values
P(x=k).
PYTHON CODE MUST PASS ALL TEST BELOW
""'"Check whether function prob is defined and has input parameter k"""
assert callable(prob), "Sorry, you didn't define function prob()"
assert (0prob(k=4))&(prob(k=4)1), "Sorry, prob(4) is a probability, which means a number from [0,1]"
"Check whether all the probabilities sum up to 1"'"
assert abs(sum(np.array([prob(k) for k in range(5)]))-1)1e-8, "Sorry, sum of all prob(k), k=0,1,2,3,4 MUST b
NOTE: The quotation above finished off to say, "Sorry, sum of all prob(k),k=0,1,2,3,4 MUST be 1"
"Check whether the 6th decimal digit of prob(k=3) is 7"""
assert np*mod((np.flr(prob(3)**10****6)),10)==7, "Sorry, wrong answer"
 Question 2 Consider two boxes. Box A contains 7 blue and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!