Boiler Plate Probability Help

Hello, I was wondering if anyone could help me with an error I keep getting with the probablity challenge.

I keep getting an error for the test_hat_draw, saying it expects two random items. I made a loop to run it 1000 times, and using the method I got there were a total of 722 reds and 278 blues, which is what you would expect if it was random as that is the ratio of red to blue.

I wrote the draw function the following way, any help would be appreciated

Untitled

Welcome to the forums @chrisw2209.

It’s always easier to diagnose these problems if you post a link to a live version of your code, at repl.it for instance, or if you post a code block as text instead of an image.

Your code is correct, but fails the test because the test is using a seed to start the random number generator and you are randomly selecting in a way that is different that the tests expect. The tests are expecting behaviour as is present in the random.choice() method of selecting objects from a list. The tests work this way so that every program will generate the same list of random numbers so that the tests are easier to write. Also, the error message for the test you are failing is ambiguous as your code does generate two random items, just not the random items that the test expects.

For further information about this, just look in the forums for some of my other posts on this challenge.

Good luck.

1 Like

thanks, I’ll look into doing it that way