All print output should include descriptions as shown in the example output below. 1) Dictionary Basics: a. Create a dictionary of fruit and desserts made from the fruit. The fruit should be the key and the dessert should be the value. Use these key value pairs: apple: sauce peach: cobbler carrot cake strawberry:sorbet banana:cream pie b. Add the mango fruit to the dictionary. Its dessert is sticky rice. c. Change the strawberry dessert to shortcake. d. Carrot is not a fruit, so remove carrot from the dictionary. e. Print the apple dessert. f. See if a banana dessert exists. g. See if a pear dessert exists. h. Print the keys in the dessert dictionary. i. Print the values in the dessert dictionary. j. Print the key-value pairs in the dessert dictionary. 2) Combining dictionaries: a. Create a dictionary named capitols1 and populate it with these key value pairs: Alabama: Montgomery Alaska:Juneau Arizona: Phoenix Arkansas: Little Rock California:Sacramento b. Create a dictionary named capitols2 and populate it with these key value pairs: California:Sac. Colorado: Denver Connecticut: Hartford Be sure that the California capitol is Sac. and not Sacramento. c. Using the dictionary update() method, update capitols1 with capitols2. d. Print the sorted capitols (values). Note the updated value of California's capitol. 3) Sets Basics: a. Create a set named class1 and populate it with the students Li, Audry, Jia, Migel, Tanya. b. Create a set named class2 and populate it with the students Sasha, Migel, Tanya, Hiroto, Audry. c. Add John to class 1. d. Print a sorted list of students who are in both classes. e. Print a sorted list of all students. f. Test to see if Sasha is in class 1.
pyth code please
![All print output should include descriptions as shown in the example output below.
1) Dictionary Basics:
a. Create a dictionary of fruit and desserts made from the fruit. The fruit should be the key and the dessert should be the value. Use these key value pairs:
apple: sauce
peach: cobbler
carrot cake
strawberry:sorbet
banana:cream pie
b. Add the mango fruit to the dictionary. Its dessert is sticky rice.
c. Change the strawberry dessert to shortcake.
d. Carrot is not a fruit, so remove carrot from the dictionary.
e. Print the apple dessert.
f. See if a banana dessert exists.
g. See if a pear dessert exists.
h. Print the keys in the dessert dictionary.
i. Print the values in the dessert dictionary.
j. Print the key-value pairs in the dessert dictionary.
2) Combining dictionaries:
a. Create a dictionary named capitols1 and populate it with these key value pairs:
Alabama: Montgomery
Alaska:Juneau
Arizona: Phoenix
Arkansas: Little Rock
California:Sacramento
b. Create a dictionary named capitols2 and populate it with these key value pairs:
California:Sac.
Colorado: Denver
Connecticut: Hartford
Be sure that the California capitol is Sac. and not Sacramento.
c. Using the dictionary update() method, update capitols1 with capitols2.
d. Print the sorted capitols (values). Note the updated value of California's capitol.
3) Sets Basics:
a. Create a set named class1 and populate it with the students Li, Audry, Jia, Migel, Tanya.
b. Create a set named class2 and populate it with the students Sasha, Migel, Tanya, Hiroto, Audry.
c. Add John to class 1.
d. Print a sorted list of students who are in both classes.
e. Print a sorted list of all students.
f. Test to see if Sasha is in class 1.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa72e8965-bd79-4464-a740-a72095a0be2c%2F2afe20d3-ca83-4c1b-84ed-d2b024ac47f6%2Fesvxb7_processed.png&w=3840&q=75)
![Sample Execution Results:
apple dessert is: sauce
banana dessert exists: True
pear dessert exists: False
dict_keys (['apple', 'peach', 'strawberry', 'banana', 'mango'])
dict_values(['sauce', 'cobbler', 'shortcake', 'cream pie', 'sticky rice'])
dict_items ([('apple', 'sauce'), ('peach', 'cobbler'), ('strawberry', 'shortcake'), ('banana', 'cream pie'), ('mango', 'sticky rice')])
Sorted state capitols: ['Denver', 'Hartford', 'Juneau', 'Little Rock', 'Montgomery', 'Phoenix', 'Sac.']
Students in both classes: ['Audry', 'Migel', 'Tanya']
All students: ['Audry', 'Hiroto', 'Jia', 'John', 'Li', 'Migel', 'Sasha', 'Tanya']
Sasha is in class1: False](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa72e8965-bd79-4464-a740-a72095a0be2c%2F2afe20d3-ca83-4c1b-84ed-d2b024ac47f6%2F30m0v4_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
//Python Code:
# Create a dictionary of fruit and desserts made from the fruit. fruit is the key and the dessert is the value.
fruit_desserts = {'apple': 'sauce', 'peach': 'cobbler', 'carrot': 'cake', 'strawberry': 'sorbet', 'banana': 'cream pie'}
# Add the mango fruit to the dictionary. Its dessert is sticky rice.
fruit_desserts['mango'] = 'sticky rice'
# Change the strawberry dessert to shortcake.
fruit_desserts['strawberry'] = 'shortcake'
# remove carrot from the dictionary.
fruit_desserts.pop("carrot")
# Print the apple dessert.
print(f"apple dessert is: {fruit_desserts['apple']}")
# See if a banana dessert exists.
print(f"banana dessert exists: {'banana' in fruit_desserts}")
# See if a pear dessert exists.
print(f"pear dessert exists: {'pear' in fruit_desserts}")
# Print the keys in the dessert dictionary.
print(f"{fruit_desserts.keys()}")
# Print the values in the dessert dictionary.
print(f"{fruit_desserts.values()}")
# Print the key-value pairs in the dessert dictionary.
print(f"{fruit_desserts.items()}")
Step by step
Solved in 6 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)