Created
March 23, 2021 07:35
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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