Making changes in a persistent dictionary

Report a typo

Complete the code below by deleting "The Silmarillion" from the "The Lord of the Rings" series, so that the length of the list stored as a value would be equal to three.

Write a program in Python 3
lib = shelve.open("my_library", writeback=False)
lib["Divergent trilogy"] = ["Divergent", "Insurgent", " Allegiant"]
lib["The Lord of the Rings"] = ["The Fellowship of the Ring", "The Two Towers", "The Return of the King", "The Silmarillion"]

# write your code here


print(len(lib["The Lord of the Rings"]))

lib.close()
___

Create a free account to access the full topic