Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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"
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

What are common ways to investigate conversion of stolen assets?

Answered: 1 week ago

Question

What does stickiest refer to in regard to social media

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago