I continue to receive the error message “key is not defined book_name” although it has been defined and used in the assignments. I have executed every item. I have restarted the kernel. I get the same error. Please help. I often get these types of errors saying a variable or item in a list is not defined when it has been defined and passed tests beforehand.
1 Like
Hi @gemarino ,
One way to check is put a print statement after the dictionary definition to see if you can access the key, book_name, here is an example:
if "book_name" in books:
print(books["book_name")
else:
print("key not found")
After adding the print statement:
Kernel → restart & clear all output
Cell → run all above (set your current cell to be the one after the cell where the print statement is)
Also check that if the autosave is activated. If not, you will have to save your editing:
file→save and checkpoint
1 Like
Hi @gemarino,
I’m going to send a direct message to you regarding this.
1 Like