✏️ Explanatory Question
| Attribute | Dictionary | List |
|---|---|---|
| Data Structure | Key-Value Pairs | Ordered Collection |
| Mutability | Mutable | Mutable |
| Indexing | Key-based | Integer-based |
| Type of Values | Heterogeneous | Homogeneous or Heterogeneous |
| Order | Unordered | Ordered |
| Keys | Unique, Immutable | No restrictions |
A dictionary is a collection of key-value pairs, where each key is unique and used to retrieve the corresponding value. Lists are ordered collections of items, which can be of any data type, including other lists. The items in a list are indexed by integers, whereas the elements in a dictionary are referenced by their keys.