Skip to content

Instantly share code, notes, and snippets.

@AnisahTiaraPratiwi
Created March 23, 2021 07:35
Show Gist options
  • Save AnisahTiaraPratiwi/3744d8c7511da1d8f029c280e4daf08d to your computer and use it in GitHub Desktop.
Save AnisahTiaraPratiwi/3744d8c7511da1d8f029c280e4daf08d to your computer and use it in GitHub Desktop.
The "toc" dictionary represents the table of contents for a book. Fill in the blanks to do the following: 1) Add an entry for Epilogue on page 39. 2) Change the page number for Chapter 3 to 24. 3) Display the new dictionary contents. 4) Display True if there is Chapter 5, False if there isn't.
toc = {"Introduction":1, "Chapter 1":4, "Chapter 2":11, "Chapter 3":25, "Chapter 4":30}
toc["Epilogue"] = 39
toc["Chapter 3"] = 24
print(toc)
print("Chapter 5" in toc)
___ # Epilogue starts on page 39
___ # Chapter 3 now starts on page 24
___ # What are the current contents of the dictionary?
___ # Is there a Chapter 5?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment