Hi @KwannateJinny,
After looking at your notebook, here’s why you are facing this issue:
In exercise 1, you are asked to create a book
dictionary using the given key/value pairs:
But what you are doing afterwards is that instead of using this book
dictionary variable you created in ex 1 every time you have to use it, you are creating a new book
variable in every following exercises, and changing the key/value pairs as you go along.
For example, you did this in exercise 2
:
book = {
'on_shelf': "False",
'on_hold': "False"
}
And then you did this is exercise 3
:
book = {
"overdue": "True",
"borrower": "Arthur Dent",
"on_hold": "False"
}
And so on…
For every exercise, you are overwriting the book
variable with key/value pair(s) needed for that particular exercise.
This is why when you have reach the cell and it tries to run book_name = book['title']
you are getting the error KeyError: 'title'
, because by this time there’s no key/value pair named title
in your dictionary.
I’m also seeing that you have added (copy/pasted) code in cells which you were not supposed to do.
Instead of cleaning the mess of the notebook, I’d suggest to get a new copy of this assignment. You can do that by opening the assignment, on the top right you should see Help
(?
), click it. When the panel opens, click on Get latest version
.
When you get the latest assignment version, re-attempt the assignment from scratch by carefully reading and following the instructions of each exercise. Even the code cell comments have straight forward hints provided in them on what to write.
Best,
Mubsi