Week2 Exercise 8 Model Costs Assertion

Hi there,
I find a weird error in assert which shows me only the “KeyError:‘costs’” but not length or type, do I make any mistake while all the above functions work perfectly.

The problem comes up from the fact that the dictionary is missing an entry for the key costs. Fix that you can proceed with the rest of the checks.

Yes, that must mean that you modified some of the logic that was given in the template code. They gave you the code to create the dictionary that is the return value from the function. If you want to get a clean copy of the notebook to see what the code looked like originally, there is a topic about that on the FAQ Thread.

One general thing to worry about is that the indentation in python is a crucial part of the syntax. If you “outdented” any of the statements in the template code, that changes the logic.