BeginnerCoder

Lesson 18 — Mini project: inventory

Combine skills

An inventory is a dict that maps each item to how many you have. d.values() gives just the quantities, d.keys() just the names, and d.items() both. Built-in helpers like sum(), max() and min() work on any of these.

sales = {"mon": 4, "tue": 7}
print(max(sales.values()))  # 7

Why it matters: shop stock, budgets and scoreboards all boil down to totals and lookups over a dict.

Want it another way?
Task

Print the total number of items in stock.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.

Keep going with Python Intermediate

Ready for more? Optional paid resources that pick up where this lesson leaves off.

Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.