6. Array

6.15 Get item from a position

We have an array called items. It has 4 items.

items = ["ice cream", "chocolate", "movies", "beaches"]

If we want second item from the array then we need to do items[1]. Yes we need to do [1] if we want second item.


If we want third item then we need to do [2].

You can see the pattern. For the 4th item we need to do [3]. This is because an array is based on zero index. It means that the first item of an array starts at zero and not at one.