Early in the lessons on list objects we learn how to access the elements by their index.

```
lst = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
```

The first element is at index 0, so,

```
lst[0] == 1 # True
```

The length is always 1 greater than the last index within range, so,

```
n = len(lst)
lst[n - 1] == 55 # True
```

Using negative indices we can access the list from the right side, where,

```
lst[-1] == lst[n - 1] # True
```

Given a random index, we need to check that it is in range (that is, valid, and which can be accessed in the list).

```
if index < len(lst)
```

when True means there is an element that corresponds to that index.

Taking into account negative indices, `-n`

is a valid index…

```
lst[-n] == lst[0] # True
```

So all indices between and including `-n`

and `n - 1`

are valid.

```
o--o--o--o--o--o--o--o--o--o--o--o
-n -1 0 n-1
```

Below we see how the two correspond…

```
o--o--o--o--o--o
-n -1
| |
o--o--o--o--o--o
0 n-1
```

For this exercise we need only concern ourselves with positive indices, or zero since the SCT does not test with any negative values for `index`

.

```
if index < n:
```

is sufficient to the requirements.

In the above list, `n`

is 10 so an `index`

of `0`

to `9`

is valid. Given that index, we can access the corresponding element in the list. let `index`

equal `9`

…

```
lst[index] == 55 # True
```

Modifying the element is a simple matter of assigning a new value to that element. In this case, we are taking the existing value and doubling it, then assigning the new value back to that element.

```
lst[index] = lst[index] * 2
new old
value value
lst[index] == 110 # True
```

Polling the list, gives,

```
[1, 1, 2, 3, 5, 8, 13, 21, 34, 110]
```

When you complete the lesson and your code is accepted,

```
n = len(lst)
if index < n:
```

can become,

```
n = len(lst)
if index in range(-n, n):
```