Hi all, I’m having a slight issue with understanding the ‘draw’ method’s instructions.

The instructions say to return the balls if the number to draw exceeds the number of balls available in the hat. My question is:

Does it mean to draw all of the balls until there are no more and then return all of the balls to the hat and keep drawing (as to get a probability still)?

Or does it mean to check the number of balls to draw and if it’s more than the count in the hat to use a return statement to end the draw method and just stop the experiment(s)?

I’m having trouble getting passed this part and I’m guessing that is why I’m not getting the last test to pass either. If someone could help clarify this for me so I can try to implement the right functionality, I would very much appreciate it!

Thanks for reading and as always, thanks fCC for everything!

If the number of ball to draw is higher than the balls in the hat, you should return all the balls. Drawn balls needs to be removed anyway from the hat, meaning that in this case the hat should be emptied.

Thanks for your reply, however I still have the same question: Do I return the balls to the empty hat or return the balls in a return statement which would in turn stop the execution of the experiment (because you can’t have a probability different from 0.0 if the experiment cant finish?)

Maybe I misunderstood your question. You always need to calculate the probability, even in the case the number of balls to draw is higher than the number of balls in the hat. Is that what you were asking?

you do not return balls to the hat, make sure to return the contents of the hat and empty the hat

1 Like

@ilenia Thank you very much for your reply, that’s exactly what I was having a hard time understanding.

@Dario_DC Thanks to you as well for trying to help me, whether you know it or not you helped me realize something that would have probably got me stuck later!

That was quite helpful because I had it stuck in my head that if the draws stopped then the probability would always be `0.0`

. However I see that is not the case, for example: `hat={'blue': 8, 'green': 3}`

if the experiment had 12 draws but expected was only say 2 blue or something small like that then it still will pass and calculate a probability…

I hope that made sense, my apologies for not being very good at explaining (or asking) things, but you helped me nonetheless!

Thank you both, and always thanks fCC for everything!

1 Like