4.1.1.2 List Properties
Computational Structures
List has following properties:
- Dynamic Size A list in Python can change its size. You can add new items to the list or remove items without any problem. The list will automatically adjust to fit the changes.
- Index-Based Access Every item in a list has a position, called an index. The first item has an index of 0, the second item has an index of 1, and so on. You can use these indexes to get specific items from the list.
- Ordered Collection The order in which you add items to a list is preserved. This means that if you add an item first, it will stay in that position unless you change it.
- Heterogeneous Elements A list can hold different types of items together. For example, you can have numbers, words, and even other lists all in one list.
- Mutability Lists are changeable, meaning you can update, add, or remove items from the list after you create it.
- Supports Duplicates A list can contain the same item more than once. This means you can repeat values in the list if needed.
python
# Example List
items = ["Decorations",