Essential Python Data Structures
Essential Python Data Structures
## Core Collections
### Lists
- Changeable ordered sequences
- Stores any data type
- Example: `items = [1, "apple", True]`
### Tuples
- Unchangeable ordered sequences
- Lightweight and efficient
- Example: `coordinates = (4, 7)`
### Dictionaries
- Key-value storage
- Instant lookup capability
- Example: `profile = {"name": "Alex", "score": 95}`
### Sets
- Stores unique elements
- Optimized for membership tests
- Example: `unique_ids = {101, 102, 103}`
## Specialized Types
### Arrays
- Single-type numeric storage
- Memory efficient
- Example: `temps = array('d', [22.1, 18.5])`
### Strings
- Fixed text sequences
- Rich text methods
- Example: `greeting = "Hello there"`
## Quick Reference