> For the complete documentation index, see [llms.txt](https://docs.arkannis.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arkannis.net/programming/courses/python-pcap-31-03-course/lists-tuples-and-dictionaries/accessing-elements-in-nested-lists.md).

# Accessing Elements in Nested Lists

## Accessing Elements in Nested Lists

```python
my_list = ['a', 'b', 'c', 1, 2, 3, ['apple', 'orange', 'bananana'], 'd']
```

If you wanted to print banana, how would you do this?

```python
# Long way:
extracted_list = my_list[6]
print(extracted_list[2])

# Short way:
extracted_fruit = my_list[6][2]
```

List elements can be changed for nested lists as well:

```python
my_list[6][2] = 'kiwi'
```
