Write a function get_total_price(class_list) that takes in a list of class call numbers and outputs the total price of all textbooks in the class list. Use the catalog list of dictionaries in the provided catalog.py file to look up a variety of information about a bookstore catalog. Hint: To access the file from within your solution, you should add an import catalog call to the top of your Python file. by calling catalog. catalog. this is the catalog file: csci = {"abbreviation":"CSCI", "department":"Computer Science", "classes": [{"number": "1133", "textbook": "Programming in Python", "price":60.00}, {"number": "3081W", "textbook": "UML Distilled", "price":45.00}, {"number": "4041", "textbook": "Introduction to Algorithms", "price":70.00}, {"number": "4511W", "textbook": "Artificial Intelligence", "price": 159.99}, {"number": "5511", "textbook": "Artificial Intelligence", "price": 159.99}]} chen = {"abbreviation":"CHEN", "department":"Chemical Engineering", "classes": [{"number": "3101", "textbook":"Chemical, Biochemical, & Engineering Thermodynaics", "price":78.95}, {"number": "3006", "textbook":"Separation Process Principles", "price":106.50}, {"number": "4214", "textbook":"Polymer Chemistry", "price":135.00}, {"number": "4708", "textbook":"Chemical Rate Processes", "price":211.25}, {"number": "8101", "textbook":"Incompressible Flow", "price":175.00}]} chem = {"abbreviation":"CHEM", "department":"Chemistry", "classes": [{"number": "1907", "textbook":"Food Lab", "price":33.00}, {"number": "2301", "textbook":"Organic Chemistry", "price":40.00}, {"number": "4021", "textbook":"Essentials of Computational Chemistry", "price":80.00}, {"number": "4701", "textbook":"Inorganic Chemistry", "price":260.00}, {"number": "8552", "textbook":"Principles of Quantum Mechanics", "price":102.65}]} biol = {"abbreviation": "BIOL", "department":"Biology", "classes":[{"number": "2012", "textbook":"Animal Diversity", "price":177.50}, {"number": "3272", "textbook":"Analysis of Biological Data", "price":168.80}, {"number": "4003", "textbook":"Genetics", "price": 44.25}, {"number": "4004", "textbook":"Molecular Cell Biology", "price":167.50}, {"number": "5309", "textbook":"Molecular Ecology", "price":151.00}]} ling = {"abbreviation": "LING", "department":"Linguistics", "classes":[{"number":"1912", "textbook":"Art of Language Invention", "price": 12.95}, {"number": "3601", "textbook":"Trask's Historical Linguistics", "price": 61.80}, {"number": "4201", "textbook":"Syntax: A Generative Introduction", "price":33.50}, {"number": "4302W", "textbook":"Introductory Phonology", "price":40.40}, {"number":"5206", "textbook":"Pragmatics", "price":33.95}]} bskt = {"abbreviation": "BSKT", "department":"Basket Weaving", "classes":[{"number": "1091", "textbook": "Basket Arts", "price":101.50}, {"number": "2223", "textbook": "Physics of Basket Weaving", "price":68.33}, {"number": "3104", "textbook": "Underwater Basket Weaving", "price":149.95}, {"number": "5103", "textbook": "Basket Weaving in Midair", "price": 43.10}, {"number": "8001", "textbook": "Zero Gravity Weaving Arts", "price":50.50}]} catalog = [csci, chen, chem, biol, ling, bskt]
Write a function get_total_price(class_list) that takes in a list of class call
numbers and outputs the total price of all textbooks in the class list. Use the catalog list of
dictionaries in the provided catalog.py file to look up a variety of information about a
bookstore catalog.
Hint: To access the file from within your solution, you should add an import catalog call to
the top of your Python file.
by calling catalog. catalog.
this is the catalog file:
csci = {"abbreviation":"CSCI", "department":"Computer Science",
"classes": [{"number": "1133", "textbook": "Programming in Python", "price":60.00},
{"number": "3081W", "textbook": "UML Distilled", "price":45.00},
{"number": "4041", "textbook": "Introduction to
{"number": "4511W", "textbook": "
{"number": "5511", "textbook": "Artificial Intelligence", "price": 159.99}]}
chen = {"abbreviation":"CHEN", "department":"Chemical Engineering",
"classes": [{"number": "3101", "textbook":"Chemical, Biochemical, & Engineering Thermodynaics", "price":78.95},
{"number": "3006", "textbook":"Separation Process Principles", "price":106.50},
{"number": "4214", "textbook":"Polymer Chemistry", "price":135.00},
{"number": "4708", "textbook":"Chemical Rate Processes", "price":211.25},
{"number": "8101", "textbook":"Incompressible Flow", "price":175.00}]}
chem = {"abbreviation":"CHEM", "department":"Chemistry",
"classes": [{"number": "1907", "textbook":"Food Lab", "price":33.00},
{"number": "2301", "textbook":"Organic Chemistry", "price":40.00},
{"number": "4021", "textbook":"Essentials of Computational Chemistry", "price":80.00},
{"number": "4701", "textbook":"Inorganic Chemistry", "price":260.00},
{"number": "8552", "textbook":"Principles of Quantum
biol = {"abbreviation": "BIOL", "department":"Biology",
"classes":[{"number": "2012", "textbook":"Animal Diversity", "price":177.50},
{"number": "3272", "textbook":"Analysis of Biological Data", "price":168.80},
{"number": "4003", "textbook":"Genetics", "price": 44.25},
{"number": "4004", "textbook":"Molecular Cell Biology", "price":167.50},
{"number": "5309", "textbook":"Molecular Ecology", "price":151.00}]}
ling = {"abbreviation": "LING", "department":"Linguistics",
"classes":[{"number":"1912", "textbook":"Art of Language Invention", "price": 12.95},
{"number": "3601", "textbook":"Trask's Historical Linguistics", "price": 61.80},
{"number": "4201", "textbook":"Syntax: A Generative Introduction", "price":33.50},
{"number": "4302W", "textbook":"Introductory Phonology", "price":40.40},
{"number":"5206", "textbook":"Pragmatics", "price":33.95}]}
bskt = {"abbreviation": "BSKT", "department":"Basket Weaving",
"classes":[{"number": "1091", "textbook": "Basket Arts", "price":101.50},
{"number": "2223", "textbook": "Physics of Basket Weaving", "price":68.33},
{"number": "3104", "textbook": "Underwater Basket Weaving", "price":149.95},
{"number": "5103", "textbook": "Basket Weaving in Midair", "price": 43.10},
{"number": "8001", "textbook": "Zero Gravity Weaving Arts", "price":50.50}]}
catalog = [csci, chen, chem, biol, ling, bskt]

Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images









