AssertionError in VSCode, but not in Coursera's online env

Do you know why exactly the same code passes all the tests in Coursera’s online environment but gets an AssertionError on my machine?

I tried several Python versions to no avail.

I can provide you with as many details as you want, I’m really curious to know why this happens.

Here’s a screenshot:

Hi @Twaijri,

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.