← Back to Dictionaries
Question 272
Inventory After A Sale
Inventory After A Sale
The dict stock counts each item on the shelf. Read an item name and then a quantity sold (two lines, no prompts; the item is always a key). Lower that item's count by the quantity and print the whole dict afterwards so every item shows, in the usual dict form. Input: two lines. Output: one line, the printed dict.
Expected Output:
{'pens': 7, 'paper': 30, 'clips': 40}= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Dictionaries
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.