Probability Calculator wrong result

Hi there,

I’ve hit the wall with this challenge. I did the code, no technical error, but i just cannot get the 0.272 probability. I checked the output of each test draw manually, by printing each draw. I don’t understand why i get more matches than i should (i get 353 matches out of 1000, although i should get 272).

Some help/feedback is really appreciated!

Link to my repl:

To point you in the right direction - take a closer look at the printed out draw results (the ones with listed balls) and check whether they make sense for the specific experiment.

I tried out about 5 new approaches for the comparison of the two dictionaries to find the match and finally i managed to get the right probability. Yet, the code gives an error: “unhashable type: ‘list’”

I do not get this error on my local machine, in jupyter notebook.
My link is above.

Some guiding would be welcome! Thank you!

Error means that in this one case the item wasn’t just an single ball of the draw, but it was also a list. So draw was a nested list. This causes an error, since item is checked against contents of the draw_dict and dictionary cannot have list as a key.

Take a closer look at how draw might have end up with a nested list instead of flat list.

1 Like

Uhhuu, i did it! It was nesting the draw list if the number of balls to draw was above 18, for some reason. I found a workaround. Thank you a lot!

1 Like