Probability Calculator - Test 3 wrong probability

I get a different probability than what is needed to pass - I get .186 instead of .272 required in the solution.
I think it has something to do with my use of random - choice. I tried some other variants - random int, random sample…but it still doesn’t pass (but it makes a small difference to my probability). So I might have gone wrong somewhere else in my code, I just don’t understand where.

Would anyone be able to take a look?

Your code so far
https://replit.com/@Helen34353/boilerplate-probability-calculator-1

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36

Challenge: Probability Calculator

Link to the challenge:

Line 74 seems wrong, as it only allows EXACT matches - but the task is to draw AT LEAST the number of expected balls.
So if I expect 2 blue and one green → then draw 2 blue and 2 green, I am successful. But your code would say “temp is 4, but only 3 balls were expected, so that’s a wrong” :wink:

Thanks for taking a look! Yes, I definitely had the wrong condition to check if the result matched the expected criteria, I’m going to rework it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.