Python:Accessing an Array
Jump to navigation Jump to search
You access a list using the square bracket notation.
The first element of list x is x
The last element of list x is x[-1]
Negative numbers indicate index from the end of the list:
Out of Bounds
If you try to read past the end of a list an exception IndexError is raised.