Python Data Structures (Brief Overview)
Python Data Structures (Brief Overview)
```python
my_list = [1, "hello", 3.14, True]
my_list.append(5) # [1, "hello", 3.14, True, 5]
```
---
```python
my_tuple = (1, 2, 3)
print(my_tuple[0]) # 1
```
---
```python
my_dict = {"name": "Alice", "age": 25}
print(my_dict["name"]) # "Alice"
```
---
```python
my_set = {1, 2, 3, 3} # {1, 2, 3}
my_set.add(4)
```
---
```python
import array
int_array = array.array('i', [1, 2, 3])
```
---
```python
text = "Hello, World!"
print(text[0]) # 'H'
```
---
✅ ✅ ✅
|--------------|-------------|-------------|----------------|-------------|
❌ ✅ ✅
| **List** | Yes | Yes | Allowed | Dynamic collections |
✅ ✅ ❌
| **Tuple** | No | Yes | Allowed | Fixed data |
✅ ❌ ❌
| **Dictionary** | Yes | (≥Python 3.7) | Keys must be unique | Key-value storage |
| **Set** | Yes | No | No | Unique elements |
✅ Yes | ✅ Yes | ✅ Allowed | Numeric data |
❌ No | ✅ Yes | ✅ Allowed | Text |
| **Array** |
| **String** |
---