Drawing Balls From Bin
Start Timer
0:00:00
Write a function to simulate drawing balls from a jar. The colors of the balls are stored in a list named jar
, with corresponding counts of the balls stored in the same index in a list called n_balls
.
Example:
Input:
jar = ['green', 'red', 'blue']
n_balls = [1, 10, 2]
# 1 green ball
# 10 red balls
# and 2 blue balls
Output
sample_multinomial(jar, n_balls) -> "blue"
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments