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.
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
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!
Before you begin
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 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.
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.
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.
“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.
I am running into below error for exercise 3 when running test your code option although running code after entering code is giving expected output “Book is ovrerdue - Contact Arthur Dent to return it”
Failed test case: Missing printed information.
Grader expected: Book is overdue - Contact Arthur Dent to return it
You got: Missing or incorrect message for book. Please make sure you are using uppercase and lowercase letters where needed. Also, check for typos
Failed test case: Missing printed information.
Grader expected: Book is overdue - Contact Arthur Dent to return it
You got: Missing or incorrect message for book. Please make sure you are using uppercase and lowercase letters where needed. Also, check for typos
I have not taken that course, but python is a case sensitive language, right? So “If” is not the same thing as “if”.
The other general point here is that when you get a syntax error near the beginning of a line like that, it’s always worth looking at the previous (non-comment) line of code to make sure that you don’t have a missing close parenthesis or other delimiter on the previous line. The notebook editor is syntax aware, so you can click on a parenthesis and it will highlight the matching one. Or not …
Is there a way to just reset C1M2_Assignment Exercise 5 and leave everything else intact? I need to look at the original content (or instruction) of Exercise 5.
There isn’t a way to reset just one part of the assignment, but here’s one way to do this:
Save your current work by downloading the notebook as it stands now:
File -> Download (as notebook ipynb file)
That saves a copy on your computer that you can later upload again.
Then do the “reset assignment” procedure documented here. That will clobber or replace everything in that assignment on the website with the clean version of the assignment. Then you have a couple of choices for how to get back your previous work:
You can rename the clean notebook and then upload your original and “copy/paste” over whatever you need to restore Exercise 5.
You can upload your old notebook under a different name and then just “copy/paste” over any of your completed work into the new clean copy of the notebook.
The key point is that the grader only grades the “official” notebook: the one that is opened when you click the link to work the assignment. So you need to make sure that file is the one you end up with that has all your work in it.
Let us know if you need any more details on how “upload” and “rename” work.
I attempted to restore the file as per instruction but didn’t see the three veritical dots on the right. Now my file greyed out after I shut it down, how can I get it back. I refreshed my browser and got it back. Back to my initial issue - how can I restore it back to original?