NameError: name 'test_your_code' is not defined in “Book Tracker” (Module 2: Automating Tasks with Python)

Hi all,
Course: AI Python for Beginners
Module: 2 – Automating Tasks with Python
Assessment: Book Tracker

All my assessments were correct, but I’m now getting this error everywhere:

NameError: name 'test_your_code' is not defined

  • I initially passed the first two assignments successfully.

  • When I moved on to assignments 3–5, this error started appearing.

  • I went back to re-run the first assignment (which had passed before), and it now shows the same error.

  • At this point, all my assignments show the same NameError.

I’m not sure how to proceed. Could this be an issue with the grader/helper not being loaded?

Things I’ve tried:

  • Restarted the kernel/runtime and ran all cells top-to-bottom.

  • Reopened the notebook and re-ran the setup/hidden cells (if any).

Request:

  • Guidance on how to re-load or re-import the grading helper (test_your_code)

  • If this is a platform issue, could someone reset the environment or advise a workaround?

Thanks

Hi @Guakona,

If you ran all the cells from top to bottom and this error appears still, then one possibility is that you accidentally deleted the test_your_code.py file from your workspace, or, you deleted the code cell/commented the code import test_your_code from within the notebook..

Open the assignment, on the top right, click on the help button (?), when the panel opens, click on Get latest version button. When the page reloads, try running all the cells again.

If the issue remains still, let me know.

Best,
Mubsi

Hi @Mubsi, thanks for the prompt reply. I am afraid I cannot ind the ‘get latest version’ button and there is no panel to open. Please see the printscreen below. Kind regards, Guakona

it also says that the save is disabled

Hi @Guakona,

You had selected the tag “coursera-platform”, hence my assumption and instructions were based on that.

But from your screenshot, I can see that you are taking the course on DeepLearning.AI’s learning platform.

Now, I was checking the course on the platform, and I came across the same issue as the one shared in your screenshot…the kernel is not connecting.

I have reported this to the team. I think because of this issue, you are having trouble in your assignments.

I’ll let you know once I hear back.

Thanks,
Mubsi

P.S I have changed your tag to “dl-ai-learning-platform”

Thank you so much. look forward to hearing from you in due course.

Hi @Guakona,

What browser are you using?

Also, could you try again.

Thanks,
Mubsi

Is the “?” (Lab Help) tool hiding underneath the “Try Again / Re-submit” button?

Hi @Mubsi Its Chrome and I tried reloading the page and executing the run function and it is the same output, I am afraid. regards, Guakona

Nope it is not :slight_smile:

Hi @Guakona,

Follow these instructions to get a fresh copy of everything in your workspace. You have to do step 5 as well. Basically delete everything and then do step 7.

Let me know if this helped.

Best,
Mubsi