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
16. Functions with dictionaries – practice
Summary

## Instruction

Perfect, it's time for additional practice!

## Exercise

Write a function named calculate_discount() that takes two dictionaries: base_prices and discounts. Both dictionaries have strings as keys and integers as values. For each item in base_prices, if there is an item with the same key in discounts, subtract the discounts value from the base_prices value. Return a dictionary with the new, discounted prices. If there was no discount for a given item, return it as it was. For instance, for the following input data:

base_prices = {
'shoes': 235,
't-shirt': 49,
'pullover': 109
}

discounts = {
'shoes': 40,
'pullover': 9
}


Your function should return the following dictionary:

discounted_prices = {
'shoes': 195,
't-shirt': 49,
'pullover': 100
}


### Stuck? Here's a hint!

Copy the original dictionary with:

base_prices.copy()