From the course: Python Data Analysis

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Tuples, lists, and the slicing syntax

Tuples, lists, and the slicing syntax - Python Tutorial

From the course: Python Data Analysis

Tuples, lists, and the slicing syntax

- [Instructor] That was a good warmup about loops. We now move on to review lists and tuples, which are perhaps the quintessential Python data structures. They're very useful on their own, but they're also foundational for data science because they set the standard interface for accessing elements and ranges of elements, but they're all in an index. Python calls that slicing. The same interface is used in NumPy, the most important Python library to manipulate large amounts of numerical data. So about lists, as you know, they provide a way to store an arbitrary number of Python objects, such as strings, floating point numbers, other lists, or any other object, and to access them using a numerical index. In Python, lists are denoted by brackets, and their elements are separated by commas For instance, the tree of nephews from the Disney universe. The length of a list is obtained with len. The empty list is written with an empty set of brackets, and obviously it has length zero…

Contents