0
How to assign NONE value (if key is not in dictionary) with âBook not foundâ using get () method?
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))
1 Answer
+ 2
oo thanks,I was trying to do twice, fist for key in dictionary, and second line separate . It was my mistake