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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.
Transcribed Image Text: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.
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
Transcribed Image Text: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
Expert Solution
steps

Step by step

Solved in 6 steps with 3 images

Blurred answer
Knowledge Booster
Dictionary
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education