LearnPy Hub
← Dictionaries problems
Easy

Update the Stock

Stock: {'pen': 10, 'book': 4}. Read an item and an amount. Add the amount to that item (create it if new) and print the dictionary.

Input

Two lines.

Output

A dictionary.

Sample 1

Input
pen
5
Output
{'pen': 15, 'book': 4}

Sample 2

Input
bag
2
Output
{'pen': 10, 'book': 4, 'bag': 2}
solution.py
Output appears here
Update the Stock · Python practice problem · LearnPy Hub