Probability Calculator (num_balls_drawn misconception)

Please can you explain how can we should do experiment, since num_balls_drawn > total_balls_in_hat ?

code from test_module:

hat = prob_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1)
probability = prob_calculator.experiment(hat=hat, expected_balls={"yellow":2,"blue":3,"test":1}, num_balls_drawn=20, num_experiments=100)
actual = probability
expected = 1.0
self.assertAlmostEqual(actual, expected, delta = 0.01, msg = 'Expected experiment method to return a different probability.')

Per the problem description

If the number of balls to draw exceeds the available quantity, return all the balls.

There’s a lot there - its easy to overlook something

It is clear now!

1 Like