Check out a free preview of the full Python Fundamentals course:
The "Tuples Review" Lesson is part of the full, Python Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

Nina reviews what was covered in the previous sections.

Get Unlimited Access Now

Transcript from the "Tuples Review" Lesson

>> Nina Zakharenko: As side note you can do unpacking kind of the variables with a list, but it's a lot less common. Returning kind of a list from a function isn't quiet as safe because you know that it's emutable, right? Maybe it'll get changed later down the line, and you won't quite know what to expect.

[00:00:23] So I recap of tools. We have the cheat sheet right here. What are they used for? Storing a snapshot of related items. That belong to a record maybe. One we don't plan on modifying, adding or removing the data. For creation, we use parentheses, empty parentheses or the tuple call for an empty tuple.

[00:00:46] Or for a tuple with one item, we have to make sure to insert that trailing comma. For a tuple with many items, insert as many commas as you want. With or without the optional parentheses, although,
>> Nina Zakharenko: You'll see it done both ways, right? Some people use it, some don't.

[00:01:11] For the search, methods my_tuple.index or item in my_tuple works just the same as list. Because there's a sequence to the tuple, things are in a particular position. Searching for an item in a large tuple is also slow. You kind of have to check each value just like with the list.

[00:01:30] Common methods, you can't add or remove from tuples but the order is preserved. Is it mutable? No, is it in-place sortable? No, because it's not mutable, right. These things are typed together.