- 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))
7 Answers
+ 5
Review lesson 54, the get() method is explained there
+ 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
+ 3
Read the task description again ā we should output "Not found", in case the book isn't found
+ 1
How do I make it output "Book not found"
+ 1
Problem solved all tests passed.
Thanks Lisa for the assistance.
0
That's where I am having challenge. How do I do that
0
I have reviewed it multiple times, but still not getting it. I am missing something