The Coursera environment has different packages installed in them where the versions of those packages are frozen i.e, they don’t update.
One possible reason is that maybe the version of some package you are using is different than the Coursera’s environment, which is why the values you get in the Coursera’s environment is different than your local machine, and the unit tests have been built in a way to pass for the values that are generated in Coursera’s environment.
It’s not reasonable to expect us to debug your computer setup for you. If you are curious, you are the one who has ready access to both environments. Start by printing some of the relevant values in both cases and see if you can find some difference that would explain the failure in your environment. This is how debugging works: you start from the evidence of the failure and then work your way backwards one step at a time.