# 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'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arkannis.net/programming/courses/python-pcap-31-03-course/lists-tuples-and-dictionaries/accessing-elements-in-nested-lists.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
