Indexing in Python
To access values within a data object, we use indexing. Indexing is the process of accessing individual elements within a data structure. In this case, the data structure is a list, but as you will soon learn, indexing is applicable to many data structures.
Note
Each element or item within a data structure is assigned a unique index or position, starting from a specific value. In Python, this value is 0. This means that the first position in any data structure in Python is located at index 0, followed by the second position, which is located at index 1, and so on.
Indexing allows you to retrieve or manipulate specific elements within the data structure by specifying their index. It provides a way to refer to elements individually rather than accessing the entire data structure as a whole.
The basic syntax for indexing a list or tuple in Python is as follows:
list_or_tuple_name[index_position]
The list_or_tuple_name
object is the name of the list...