Functions_List_Tuple_String
Functions_List_Tuple_String
Below is a detailed explanation of common functions used with lists, tuples, and strings in Python.
---
## **List Functions**
```python
my_list = [1, 2, 3]
my_list.append(4)
```
- Extends the list by appending elements from another iterable (e.g., list, tuple).
```python
my_list = [1, 2, 3]
Functions of Lists, Tuples, and Strings in Python
my_list.extend([4, 5])
```
```python
my_list = [1, 2, 4]
my_list.insert(2, 3)
```
---
## **Tuple Functions**
```python
my_tuple = (1, 2, 2, 3)
print(my_tuple.count(2)) # Output: 2
```
Functions of Lists, Tuples, and Strings in Python
---
## **String Functions**
```python
my_string = "hello"
```