Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dictionary basics
Dictionaries in loops and conditional statements
Dictionaries in functions
Summary
20. Exercise 3

Instruction

Perfect!! Finally, the last question.

Exercise

Given a pricelist in the template, write a function named calculate_price() that takes a dictionary structured in the following format:

customer_order = {
    'cheese': 3,
    'coke': 2
}

The customer order contains a list of item purchases with quantities as values. The function should return the total cost for the whole order. If a given item is not present in the pricelist, simply ignore it.