Module-2 Programming Assignment: Book Tracker

Here is the code I entered for the assignmet: ### START CODE HERE ###
book = {
“title”: “To Kill a Mockingbird”,
“author”: “Harper Lee”,
“on_shelf”: False,
“borrower”: “Arthur Dent”,
“overdue”: True,
“on_hold”: False
}

Create the dictionary, “book”, with key/value pairs as mentioned above

Please be sure to use the same upper/lower case spellings structure

Add your code here

END CODE HERE ### I also checked my code with the chatbot. Here is it’s response: Great job! Your dictionary initialization now looks correct. You have properly used colons to separate keys from values and commas to separate each key-value pair. The boolean values are also correctly formatted. However I am getting this error code from the Jupyter notebook: NameError Traceback (most recent call last)

Cell In [3], line 2
1 # Test your code!
----> 2 test_your_code.exercise_1(book)

NameError: name ‘test_your_code’ is not defined
I don’t know how to correct this error.

1 Like

After you opened the notebook, did you run every cell starting from the top?

Thank you for your reply. As an absolute beginning programmer, I only follow the instructions that are included in each lesson. I did not see any part of the instructions advising me to “run every cell starting from the top”. In case I missed something, here are the lesson instructions. Thank you again. Programming Assignment: Book Tracker :books:

Welcome to the programing assignment of the second module of this course!

Get ready to put your Python skills to the test. In this assignment, you’ll be a librarian, managing the book records. Let’s get started! :rocket:

Before you begin :vertical_traffic_light:

If you need a fresh copy of the assignment (reset), follow the instructions under the heading, “Refreshing your Workspace”.

INSTRUCTIONS FOR ATTEMPTING THE ASSIGNMENT:

  • Before starting each exercise, read the instructions carefully. Look for the part called Your Task, it tells you exactly what you need to code and gives you all the details you need.

  • In each exercise cell, look for comments ### START CODE HERE ### and ### END CODE HERE ###. These show you where to write your code. Do not add or change any code that is outside these comments, or add any extra code cells in the notebook.

  • After you finish coding an exercise, there will be a test section that checks your work using a function called test_your_code. If everything is correct, you’ll see a message saying “All tests passed!” and you can move on. If there’s a mistake, you’ll see a red message explaining what went wrong, so you can fix it.

  • Before submitting your notebook for grading, ensure ALL exercises are complete (gotten All tests passed! for all of them). Save your work by clicking the :floppy_disk: icon at the top left, then click the Submit assignment button at the top right.

ASKING FOR HELP IN THE COMMUNITY FORUM:

  • Sign up for our Community Forum if you haven’t already. Once signed up, post your questions in the AP4B category with detailed information, such as the item’s name, exercise number, or code cell. This helps others understand your issue better. Share screenshots if you can, but don’t post solution code publicly; instead, share the error message you receive.

With that out of the way, let’s begin!

Table of Exercises

Assignment Starts From Here

Before starting the assignment, run the cell below. It will bring in some helpful code to check if your solutions are correct and provide feedback if you need to make changes. You’ll learn more about how this works as you progress through the course.

IMPORTANT NOTE: Always run this cell when starting or resuming your assignment. DO NOT include it in any other notebook cells. When I run the cell test_your_code.exercise_1(book) I get the error code "NameError ‘test_your_code’ is not defined.

1 Like

Consider my reply to be some bonus instructions.

While your reply is appreciated, and they may or may not be helpful with this particular issue, I definitely do not see how your bonus instructions can possibly help with the rest of the lesson nor with passing the course. However I will consider every one of my experiences when considering renewing my subscription and whether or not to continue with any of Mr. Ng’s courses. Thank you again.

1 Like

Good luck!

Hi @daleberry123,

“run every cell starting from the top” instructions are provided in the assignment. Please read through this part of the instructions you shared from your assignment.

These instructions come just before the first code cell of the notebook:

import test_your_code

Additionally, I’d recommend you read through some of these common mistakes made by learners as well.

Best,
Mubsi

2 Likes