I have completed the probability calculator but instead of getting a probability of .272 I am getting a probability of .252.
Any suggestions on what I’m doing wrong?
Here’s a link to my code : https://replit.com/@dchris/boilerplate-probability-calculator#prob_calculator.py
Your browser information:
User Agent is:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Challenge: Probability Calculator
Link to the challenge:
In case you are still struggling: I tested parts of your code in my working solution.
The way you draw balls is flawed. I cannot say what exactly, though working around using
random.randint() did the trick.
There might be an issue with the random-library here, given the code provides a seed (meaning the random distribution is actually fixed) → the implementation you chose might simply result in another distribution which is technically correct randomness but the test expects another one.
Yeah, your basic process is OK but doesn’t agree with how the test output was generated.
Side note, it doesn’t cost you extra to use words in character names. We don’t have fixed line widths anymore, lol.
ball_taken is easier for you (and especially us) to read, understand, and remember than
btaken. Longer variable names with words are good.
duly noted, thank you both for your help.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.