![]() ![]() |
Conceptual Review (page 36 of 55) |
We have fewer methods and functions available with tuples relative to lists because tuples are immutable. For instance, we cannot reverse() or sort() the items in an immutable tuple.
We can loop over the items in a tuple similar to how we loop over items in a list. We have the same indentation rules after the ":".
We can also use the enumerate function in our finite for loops, which functions exactly the same as with lists.
We may also cast or convert other collections to an immutable tuple by using the tuple() function to write-protect our data.