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.
Answers
Answered by
1
Answer:
toc = {"Introduction":1, "Chapter 1":4, "Chapter 2":11, "Chapter 3":25, "Chapter 4":30}
# Epilogue starts on page 39
toc.update({"Epilogue":39})
# Chapter 3 now starts on page 24
toc["Chapter 3"]=24
# What are the current contents of the dictionary?
print(toc)
# Is there a Chapter 5?
if "Chapter 5" in toc==True:
print("True")
else:
print("False")
Explanation:
Answered by
0
Answer:
# Add an entry for Epilogue on page
toc["Epilogue"]=39
#Change the page number for Chapter 3 to 24
toc["Chapter 3"]=24
#Display the new dictionary contents
print(toc)
#Display True if there is Chapter 5, False if there isn't.
print("Chapter 5" in toc)
Explanation:
Similar questions