C1M1_Assignment: Exercise 1-A: NameError: name 'test_your_code' is not defined

After correctly defining variables for line one tap Shift + Enter, I select line two, tap Shift + Enter and get the following error:

NameError                                 Traceback (most recent call last)
Cell In [3], line 2
      1 # Test your code!
----> 2 test_your_code.exercise_1a(book_title, author, year_published, available_copies)

NameError: name 'test_your_code' is not defined

Chatbot reports the following:

test_your_code as something that has been defined or imported in your code.

When and where do I import or define test_your_code.exercise_1a??

This is having a downstream affect:
but I am getting a name error.

print(f"Title: {book_title}")
print(f"Author: {author}")
print(f"Published: {year_published}")
print(f"Available Copies: {available_copies}") 

But I am getting the following error:

NameError: name 'available_copies' is not defined

Hi @0gsl, welcome! I tried reproducing the error you are getting, and I think it is likely happening because you haven’t run the first line of code in the assignment (“import test_your_code”), and later steps cannot find the necessary Python module. If you go to the beginning of the assignment, there is a section called Before you begin, and you should run that line first, so that it imports the tests. Please let me know if this helps.

1 Like

Thank you so much, that was the issue!

1 Like