Articles
The problem...
You have a dict. But you don't always know what's in it.
Is a specific key there? How many entries does it have? What are all the keys?
You need tools to look in…
The problem...
You have a dict with ten entries. Twenty. A hundred.
You need to do something with every key, every value, or every pair.
Writing it out manually isn't an option…
The problem...
You have three soldiers. Each one has a name, a score, and a status.
You could store them as three separate dicts:
raven = {"score": 85, "active": True}
wolf =…
What you're building
A tip calculator. The user enters the bill amount and rates the service. The program looks up the tip percentage from a dict and calculates how much to leave…
What you're building
The shopping list is back. But this time each item has a quantity and a price.
A dict instead of a list. More data per entry. Total at checkout.
What you n…
What you're building
A pet shop manager. Each animal has a name, species, price, and availability.
The user can view all animals, search by name, and mark one as sold.
What you…