Hi,
I can either pass the probability_experiment test or the hat_draw test but not both. The error that I’m getting is quite straight forward to fix, but I can’t fix it without messing up the experiment.
The error I’m getting is:
“AssertionError: 7 != 5 : Expected hat draw to reduce number of items in contents.”
I’ve tried changing my code so that the draw function “takes balls” out of the contents of the hat with each iteration of the draw, but I can’t seem to get the hat to return to its original value after each time the draw function is used. This means that the probability calculation is messed up.
The way I have tried to fix it it is by recording the self.contents in a variable at the start of the draw function, then I try to reassign that to self.contents after the draw has been performed but before the return statement, but it doesn’t seem to work.
I’m finding it very hard to explain but perhaps looking at my code will make it clearer. Thanks in advance…