Index Ai Academy
Glossary · Phase 0 · Tools

Dictionary

Also written: dictionaries, dict

A collection of key–value pairs, like a contacts list that maps a name to a phone number.

Use a list when order matters and you'll go through the items one by one: the steps of a recipe, or a day's orders. Use a dictionary when you want to look something up by name: a customer by their email, or a price by its product code.

Try it now

Step through and watch the stock variable after each line: one key added, two values changed, one key removed. The last line reads a key that doesn't exist, safely.

Learn it properly

Dictionaries · Look values up by name: the shape of almost all real-world data. About 25 minutes.

Start this free lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write