- 1

Please help me complete this code to pass all tests

books = { "Life of Pi": "Adventure Fiction", "The Three Musketeers": "Historical Adventure", "Watchmen": "Comics", "Bird Box": "Horror", "Harry Potter":"Fantasy Fiction", "Good Omens": "Comedy" } book = input() #change this part to use the .get() method print(books.get(book))

3rd Jan 2022, 6:55 PM
ibrahim agboola
ibrahim agboola - avatar
7 Respuestas
+ 5
Review lesson 54, the get() method is explained there
3rd Jan 2022, 7:08 PM
Lisa
Lisa - avatar
+ 4
"A useful dictionary method is get. It does the same thing as indexing, but if the key is not found in the dictionary it returns another specified value instead ('None', by default)." Look at the examples with the get() method – notice which arguments it takes
3rd Jan 2022, 7:52 PM
Lisa
Lisa - avatar
+ 3
Read the task description again – we should output "Not found", in case the book isn't found
3rd Jan 2022, 7:05 PM
Lisa
Lisa - avatar
+ 1
How do I make it output "Book not found"
3rd Jan 2022, 7:07 PM
ibrahim agboola
ibrahim agboola - avatar
+ 1
Problem solved all tests passed. Thanks Lisa for the assistance.
3rd Jan 2022, 7:55 PM
ibrahim agboola
ibrahim agboola - avatar
0
That's where I am having challenge. How do I do that
3rd Jan 2022, 7:06 PM
ibrahim agboola
ibrahim agboola - avatar
0
I have reviewed it multiple times, but still not getting it. I am missing something
3rd Jan 2022, 7:47 PM
ibrahim agboola
ibrahim agboola - avatar