Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
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 Resposta
+ 2
oo thanks,I was trying to do twice, fist for key in dictionary, and second line separate . It was my mistake