In programming, you often need to work with groups of data — not just single values. Python provides two main collection types for this: lists and dictionaries. These are similar to arrays in other programming languages. They let you store and manage many values at once, which is essential when building anything more than a basic program.
Although we’re not using databases at this stage, combining lists and dictionaries allows us to build table-like structures — similar to a spreadsheet or a simple database. This is helpful when we need to store and retrieve related information, like player stats, food menus, or item inventories.
Lists
A list is an ordered collection of items — such as names, numbers, or even other lists. Each item is stored in a position (called an index), and you can use loops to go through the list, add or remove items, and access data by index. Lists are ideal for storing sequences where order matters.
Dictionaries
A dictionary stores data using key-value pairs, which means each piece of data has a label (the key) and a value. This makes it easy to look things up, update values, or store information with meaning — like {"name": "Alex", "score": 10}. Dictionaries are great for storing structured information, especially when combined with lists to create more complex systems.