Module 2, Programming Assignment, After Quiz 2, Book Tracker

Description In the Book Tracker Assignment, I keep getting a NamerError that the test_your_code.exercise_book1(book) is not defined.
Also, when I begin defining the dictionary, as soon as I start writing the first string, the text is immediately red-which leads to a syntax error message. I then typed without the quotation marks and the text turns black. Once I run the code, I don’t get the syntax error, instead I get the NameError referring to the test_your_code. Can anyone help me?

1 Like

Hi @daleberry123,

Coding environments like Jupyter notebooks use colours to give you clues about your written code.

When text you type inside quotation marks (like "hello" or 'world') turns red, that’s perfectly normal. It’s the environment’s way of showing it recognizes that text as a string. If you’re getting a syntax error even when the text is red, the problem is likely a small mistake with how the string itself is written. For example, you might have forgotten the closing quotation mark.

If you intend to create a string but the text appears black, it means the environment doesn’t see it as a string. This usually happens if the quotation marks are missing or not typed correctly around the text.

As for the errors you say you are getting, please read through these common mistakes learner make.

Let me know if you’d still be encountering issues after this.

Best,
Mubsi

1 Like