Tell us what’s happening:
This is the last challenge of “Scientific Computing With Python”
The only test failure I am getting on my code is this.
FAIL: test_hat_draw (test_module.UnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/runner/boilerplate-probability-calculator/test_module.py", line 16, in test_hat_draw
self.assertEqual(actual, expected, 'Expected hat draw to return two random items from hat contents.')
AssertionError: Lists differ: ['red', 'red'] != ['blue', 'red']
First differing element 0:
'red'
'blue'
- ['red', 'red']
? ^ -
+ ['blue', 'red']
? ^^^
: Expected hat draw to return two random items from hat contents.
----------------------------------------------------------------------
Ran 3 tests in 0.052s
FAILED (failures=1)
Running draw()
outside of the test modules confirms that the results are (pseudo-)random despite what the tests say, but evidently it’s not the “right” kind of random. Which randomization method does the test module prefer?
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0
Challenge: Probability Calculator
Link to the challenge: