LearnPy Hub
← Dictionaries problems
Easy

Remove a Key

Start with stock = {'pen': 10, 'pencil': 5, 'eraser': 3, 'ruler': 7}. Read a key and remove it with pop(), printing the removed value and then the dictionary.

Input

One word (always a key).

Output

Two lines.

Sample 1

Input
pen
Output
10
{'pencil': 5, 'eraser': 3, 'ruler': 7}

Sample 2

Input
eraser
Output
3
{'pen': 10, 'pencil': 5, 'ruler': 7}
solution.py
Output appears here
Remove a Key · Python practice problem · LearnPy Hub