I rarely ask people to check my finished projects, but in this case I am quite dissatisfied with my solution to the problem.
The reason is that, in order to arrive at a solution to the problem, I had to make two different ‘draw()’ methods (draw and draw_2). I did this for the following cases:
- draw: used for tests where they give you a hat with x balls and draw some balls out of the hat, where the numbers of balls drawn in each iteration is lower than x
- draw_2: used for that final test where they give you a hat with 19 balls but tell you that in each iteration you will draw 20 balls out of the hat
Do you know of a more efficient solution to tackle that one case where the number of balls to be drawn is larger than the number of balls in the hat? Also, why would they suggest this case in the first place, it would seem like an odd experiment to perform…
Thanks for your time!