DLS Course 1 - Week 4 - Assignment 1 - Exercise 10

It looks like you succeeded on the test case that is shown in the notebook, but the one that fails is different. It’s in the file public_tests.py. Maybe you should take a look at that test case and see what is different about it. Perhaps you hard-coded something so that it works with one test, but not the other.

One other thing to check: did you use “-=” to do the updates? If so, that fails the test unless you “deepcopy” the inputs to break the connection to global variables. Here’s a thread which explains what is going on there. Note that they try to help you in the template code by doing a “flat” copy, but that is not enough with a dictionary: you need copy.deepcopy(). That is explained on the thread that I linked. Make sure to read all the way through the thread to get to this later post.