Chapter 3

Speeding Along with Lists and Tuples

IN THIS CHAPTER

Bullet Defining and using lists

Bullet Working with sets of information

Bullet What’s a tuple and who cares?

Bullet When tuples are ideal

Bullet How to make a tuple

Bullet Accessing a tuple’s data

Sometimes in code you work with one item of data at a time, such as a person’s name or a unit price or a username. There are also plenty of times where you work with larger sets of data, like a list of people’s names or a list of products and their prices. These sets of data are often referred to as lists or arrays in most programming languages.

Python has lots of really great ways for dealing with all kinds of data collections in easy, fast, and efficient ways. You learn about those in this chapter. As always, I encourage you to follow along hands-on in a Jupyter notebook or .py file as you read this chapter. The “doing” really helps with the “understanding” part, and ...

Get Python All-in-One For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.